33 lines
1.9 KiB
Org Mode
33 lines
1.9 KiB
Org Mode
:PROPERTIES:
|
|
:ID: df046fd7-1f82-4e12-9065-56d222f56408
|
|
:END:
|
|
#+title: docker
|
|
#+filetags: :docker:
|
|
Docker ist the programm designed to self-host services on the web through so called [[id:936191f2-696b-4d9a-96ad-c8449778ae26][container]]. A container is a closed system, that can interact with other containers. One Container can run one application and expose this application to a [[id:f4bb4857-2112-4e10-a22e-6da1436ce7b7][port]] on the [[id:f2b1d5af-1a7d-47a5-95c8-4a85d558419e][server]]. A list of all deployed and undeployed containers can be found in the [[id:add49718-44d1-4576-9e5a-aea5d025c53b][list of docker containers]].
|
|
|
|
To Start a container use
|
|
#+begin_src
|
|
docker run <docker image>
|
|
#+end_src
|
|
|
|
You can use an application called [[id:fcbfabfa-4a8c-4826-8b57-5dce05965c76][docker-compose]] to start multiple containers simultaneously and define variables and settings for them beforehand.
|
|
|
|
Additionally you can set the following parameters (listed below) together with the run command. Those parameters are important to get the containers running and can also be implemented into docker-compose.
|
|
* run parameters
|
|
#+begin_src bash
|
|
--name "<name of container>"
|
|
#+end_src
|
|
creates a verbose name for the container. If no container name is set, docker choooses a random one.
|
|
#+begin_src bash
|
|
-v "<volume directory of host>:<volume directory of container>"
|
|
#+end_src
|
|
[[id:c69a77dc-f87f-418c-9870-eedddc43be37][Mounts]] a volume to the container. This Volume is located at the given path in the host file system and all files in the given folder are represantations of the same files in the container folder of the given container path.
|
|
#+begin_src bash
|
|
-e "<ENVIRONMENT_VARIABLE>"
|
|
#+end_src
|
|
Sets a desired environment variable for the container.
|
|
#+begin_src bash
|
|
--network "<docker network>"
|
|
#+end_src
|
|
Connects the container to the given [[id:9d04fac3-89ae-4a96-b326-9ae7e2c22118][docker-networks]]
|