Docker
·1 min
Setup #
- Installation guide: https://docs.docker.com/engine/install/ubuntu/
- No
sudo
: Check this to allow Docker containers to run as non-root.
See what’s running #
docker ps
Container-specific commands #
# SSH into a running container.
docker exec -it 0061ecc7ef37 /bin/bash
# Restart
docker restart 52835f0907e8
# Stop
docker container stop 23642fbe8515
# Stop all
docker stop $(docker ps -a -q)
# Prune all stopped containers
docker container prune
Parameters for docker run
#
-d
: Run as daemon.-p 8439:8080
: Map port A externally to B internally.-v ~/Documents/TiddlyWikiDockerVolume:/var/lib/tiddlywiki
: Map volume A externally to B internally.-e USERNAME="abc"
: Environment variable.--restart unless-stopped
: Automatically bring up the container on Docker daemon restart.
Compose #
# Assuming current directory contains a file named *docker-compose.yml*
docker-compose up
# Or
docker-compose down
Uprade an existing service #
The following assumes that the containers are stateless.
docker images # First, verify what image version is currently present.
docker pull wallabag/wallabag
# Stop and remove existing containers
docker stop 52835f0907e8
docker rm 52835f0907e8
# Restart a new one
docker run ...