Docker: Difference between revisions

From MTU LUG Wiki
Jump to navigation Jump to search
(Created page with "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 - Environment variables - Debian 12 in...")
 
No edit summary
Line 6: Line 6:
Containers - running images configured with system storage volumes, environment variables, tags and an image (with an optional version)
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.
Volumes -


Environment variables -
Environment variables - static settings for the container.


Debian 12 installation:
Debian 12 installation:
Line 32: Line 32:


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.
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:

Revision as of 00:19, 28 July 2024

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: