docker:containers:create_a_container
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docker:containers:create_a_container [2020/05/13 09:23] – peter | docker:containers:create_a_container [2022/09/19 14:29] (current) – [Run a Container that does not stop automatically] peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Docker - Containers - Create a container ====== | ====== Docker - Containers - Create a container ====== | ||
- | Create a container by simply running | + | Create a container by using **docker run** + the image name you would like to run + the command to run within the container. |
- | If the image doesn' | + | <code bash> |
+ | docker run [image_name] [command to run within the container] | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | |||
+ | For Example: | ||
<code bash> | <code bash> | ||
Line 23: | Line 32: | ||
docker run -ti ubuntu | docker run -ti ubuntu | ||
</ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
* **-t**: | * **-t**: | ||
* **-i**: | * **-i**: | ||
- | This allows continuous use of the container until the terminal is exited by running the "exit" | + | This allows continuous use of the container until the terminal is exited by running the **exit** command. |
When the container is created, it is given its container ID and a randomly-generated name. | When the container is created, it is given its container ID and a randomly-generated name. | ||
Line 40: | Line 51: | ||
</ | </ | ||
+ | |||
+ | </ | ||
docker/containers/create_a_container.1589361818.txt.gz · Last modified: 2020/07/15 09:30 (external edit)