Docker is a software platform for delivering applications in container run by docker engine.
Installation
Follow the official documentation for installing the docker engine in your system.
Basic Commands
Pull an image from Docker Hub
List docker images
Run docker image in a detach container
List the running containers
Get the shell
Stop the container
Start the container
start an existing container
Delete a container
Remove an image
Management
Docker has many built-in tools for managing the docker container
Dockerfile
Dockerfile is text document for assembling a docker image for the productions
&& \
FILE requirements.txt
numpy
Build docker image from Dockerfile
Docker volume
Docker network
Docker supports several types of network adapter: bridge, host, none, macvlan, ipvlan etc.
Docker compose
Docker compose is a tool for managing and defining multicontainer application in a single compose file.
Create docker-compose.yml file (example from https://linuxserver.io )
---
version: "2.1"
services:
calibre-web:
image: lscr.io/linuxserver/calibre-web:latest
container_name: calibre-web
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- DOCKER_MODS=linuxserver/mods:universal-calibre #optional
- OAUTHLIB_RELAX_TOKEN_SCOPE=1 #optional
volumes:
- /path/to/data:/config
- /path/to/calibre/library:/books
ports:
- 8083:8083
restart: unless-stopped
then run in detach mode
to get the log
Misc
To remove all the containers
To remove all the images