Docker

From MTU LUG Wiki
Revision as of 23:19, 27 July 2024 by Allennova (talk | contribs)
Jump to navigation Jump to search

Docker is a container solution for any operating system. Docker containers can run as a user, allowing for rootful and rootless containers, allowing for more security.

Concepts: Images - A built software on top of a slim operating system, made into a prebuilt image ready for download

Containers - running images configured with system storage volumes, environment variables, tags and an image (with an optional version)

Volumes - internal storage passed through from host machine files and folders.

Environment variables - static settings for the container.

Debian 12 installation:

sudo apt-get update

sudo apt-get install docker docker-compose


Common Docker Commands:

Keep in mind what permission level you are running containers in. Rootful containers will need sudo level permissions.

docker container --help

docker container ls

docker container kill

docker container logs

Docker Compose:

simplifies docker down to files instead of commands, allows for full stacks to be built in a single file. Docker can then pull all images specified and build the container accordingly with one command.

regular docker command:

docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

docker compose: