Skip to content

How to uninstall a dockerized service

If, at some point, you want to remove a dockerized service, you can do by performing the following steps:

  1. Stop the service

    cd ~/services
    docker compose stop <your_service>
    
    cd ~/services
    docker compose stop caddy
    
  2. Remove the service.

    docker compose rm <your_service>
    
    docker compose rm caddy
    
  3. Remove the service image

    Use this command to find the image used by your service:

    docker images | grep <your_service>
    
    docker images | grep caddy
    

    The 3rd column should contain your service's IMAGE ID (e.g b9bbeefe771a).

    Then, remove the it:

    docker rmi <IMAGE ID>
    
    docker rmi b9bbeefe771a
    
  4. Remove the folder

    cd ~/services
    rm -rf <your_service> # might need sudo
    
    cd ~/services
    rm -rf caddy # might need sudo