6,566
edits
Merspieler (talk | contribs) (→Docker scenery toolchain image: Simplified getting files into the container by mounting a directory.) |
(→Docker scenery toolchain image: Shifted the volume or shared directory instructions into its own subsection and minor editing and wiki formatting of the test. The non-mounted file copy instruction has hence been undeleted.) |
||
Line 24: | Line 24: | ||
<syntaxhighlight lang="shell"> | <syntaxhighlight lang="shell"> | ||
docker run -i -t flightgear/terragear /bin/bash | docker run -i -t flightgear/terragear /bin/bash | ||
</syntaxhighlight> | </syntaxhighlight> | ||
When you exit from the bash shell, the container will be stopped. Use the following commands to list all the containers, start the container up, and execute an interactive bash shell on it | When you exit from the bash shell, the container will be stopped. Use the following commands to list all the containers, start the container up, and execute an interactive bash shell on it. | ||
<syntaxhighlight lang="shell"> | <syntaxhighlight lang="shell"> | ||
docker container ls -a # List all containers, even those stopped | docker container ls -a # List all containers, even those stopped | ||
docker container start <container_name> # Start and existing container | docker container start <container_name> # Start and existing container | ||
docker container cp <source_file> <container_name>:<destination> # Copy a file into the cotnainer | |||
docker container exec -i -t <container_name> /bin/bash # Run a bash shell, and connect to it. | docker container exec -i -t <container_name> /bin/bash # Run a bash shell, and connect to it. | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Now, when you exit, the container will continue running | Now, when you exit, the container will continue running | ||
=== Mounting a volume or shared directory === | |||
To mount a volume or shared directory, use: | |||
<syntaxhighlight lang="shell"> | |||
docker run -i -t flightgear/terragear /bin/bash -v <host directory>:<docker directory> | |||
</syntaxhighlight> | |||
where <code><host directory></code> is the directory on your computer that's mounted into the container and <code><docker directory></code> is the directory where the computers directory is mounted in. Then to copy files into the docker container, simply move them into the <code><host directory></code> on the host operating system and you'll find them in the <code><docker directory></code> in the docker container. |