Skip to main content Link Search Menu Expand Document (external link)


This will be also about project connected to or running on Docker, like Portainer.

Docker software

A container run an image.
Data are in /var/lib/docker/volumes/.

Install guide for Linux here. Don’t forget to add yourself to the docker group: usermod -a -G docker $USER

Container management

  • Run docker run -d --name container_name image with image nginx for example
  • Stop docker stop container_name
  • Restart docker restart container_name
  • Pause docker pause container_name and docker unpause container_name
  • Kill docker kill container_name
  • Remove docker rm container_name
  • Bash/See what’s going on docker attach container_name
    • And CTRL+P then CTRL-Q to detach
  • Update docker update [OPTIONS] CONTAINER
    • Add restart policy: docker update --restart=always CONTAINER

Images management

  • List docker images
  • Remove docker rmi image_name
  • List of images are in the Docker Hub
  • An previously downloaded image can be used by referring its image ID

Data management

  • Browse data in volumes: /var/lib/docker/volumes/
  • Transfer a file from/to a container docker cp CONTAINER:SRC_PATH DEST_PATH

Other commands

  • Get Docker directory docker info
  • List all containers docker ps -a
  • Run a command in a container docker exec container_name command
  • Do some spring cleanup - (Be careful with that!) docker system prune --all

Portainer - Web container management

Helps to manage containers.

  • Run docker run --restart always -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
  • Automatically remove old images: define the variable WATCHTOWER_CLEANUP=true
  • Fix IP in exposed port: change Public IP in Endpoints - Source

Watchtower - Automatic container update

Update containers automatically. Run the quick start script to install.

Environment variables:

  • TZ:timezone: Timezone
  • WATCHTOWER_SCHEDULE: 0 0 5 * * *: cron setting to check for update each day at 0500.

Chrony / Docker-NTP

Provide a NTP server.

  • 123:UDP need to be exposed