Docker is a set of platform as a service products that uses OS-level virtualization to deliver software in packages called containers.
Install Link to heading
Install on Ubuntu/Debian Link to heading
1# Install docker to the system
2sudo apt install docker.io
3
4# Setup autostart for service and start it
5sudo systemctl start docker
6sudo systemctl enable docker
7
8# Add current user to the docker group"
9sudo usermod -aG docker $USER
Command line Link to heading
Download docker image Link to heading
1docker pull <image name>
Create “my-image” docker image from the current directory Link to heading
1build -t my-image .
Run container from an image Link to heading
1docker run <image name>
2# run as a service
3docker run -d -p 8080:80 --restart=always --name nginx-dev nginx
Remove container Link to heading
1docker rm <container name>
Remove image Link to heading
1docker rmi <image name or id>
Open shell with the specoific container Link to heading
1docker exec -it --name ubuntu bash
Show all running containers Link to heading
1docker ps
2# all containers
3docker ps --all
4# show id only
5docker ps --quiet
Remove unused containers Link to heading
1docker rm $(docker ps -q -f 'status=exited')
Remove unused image Link to heading
1docker rmi -f $(docker images -f "dangling=true" -q)
Remove orphaned volumes Link to heading
1docker volume rm $(docker volume ls -qf dangling=true)
instructions) Link to heading
1echo "Cleaning up old containers..."
2docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v 2>&1 | cat;
3echo "Cleaning up old volumes..."
4docker volume ls -qf dangling=true | xargs docker volume rm 2>&1 | cat;
Show disk usage by docker images and containers Link to heading
1docker system df
2docker system df --verbose
Show console GUI - dockly: npm install -g dockly
Link to heading
1dockly
Links Link to heading
- Awesome Docker
- Chrome App Store: Simple Docker UI