Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "Howto:Docker scenery toolchain"

From FlightGear wiki
Jump to: navigation, search
m (cat: Scenery software)
 
(7 intermediate revisions by 5 users not shown)
Line 2: Line 2:
  
 
== Docker setup ==
 
== Docker setup ==
 +
Firstly, download Docker for your computer.  Then check it's working
 +
 
<syntaxhighlight lang="shell">
 
<syntaxhighlight lang="shell">
docker --version
+
docker --version
 
docker info
 
docker info
docker run hello-world
+
docker run hello-world # Run a demo container
 +
docker container ls -a  # List all the containers, their names and status.  Note that the hello-world is shown as "Exited"
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Docker scenery toolchain image ==
 
== Docker scenery toolchain image ==
 +
Now retrieve the terragear toolchain image.
  
 
<syntaxhighlight lang="shell">
 
<syntaxhighlight lang="shell">
 
docker pull flightgear/terragear
 
docker pull flightgear/terragear
 
docker images
 
docker images
 +
</syntaxhighlight>
 +
 +
You can now instantiate containers based on this image.  The following command will create a container and then run an interactive bash shell on it.
 +
 +
<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.
 +
 +
<syntaxhighlight lang="shell">
 +
docker container ls -a    # List all containers, even those stopped
 +
docker container start <container_name>  # Start an existing container
 +
docker container cp <source_file> <container_name>:<destination> # Copy a file into the container
 +
docker container exec -i -t <container_name> /bin/bash  # Run a bash shell, and connect to it.
 +
</syntaxhighlight>
 +
 +
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 -v <host directory>:<docker directory>-t flightgear/terragear /bin/bash
 +
</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.
 +
 +
[[Category:Scenery software]]

Latest revision as of 12:21, 13 August 2019

This article is a stub. You can help the wiki by expanding it.

Docker setup

Firstly, download Docker for your computer. Then check it's working

docker --version  
docker info
docker run hello-world  # Run a demo container
docker container ls -a  # List all the containers, their names and status.  Note that the hello-world is shown as "Exited"

Docker scenery toolchain image

Now retrieve the terragear toolchain image.

docker pull flightgear/terragear
docker images

You can now instantiate containers based on this image. The following command will create a container and then run an interactive bash shell on it.

docker run -i -t flightgear/terragear /bin/bash

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.

docker container ls -a    # List all containers, even those stopped
docker container start <container_name>   # Start an existing container
docker container cp <source_file> <container_name>:<destination> # Copy a file into the container
docker container exec -i -t <container_name> /bin/bash   # Run a bash shell, and connect to it.

Now, when you exit, the container will continue running

Mounting a volume or shared directory

To mount a volume or shared directory, use:

docker run -i -v <host directory>:<docker directory>-t flightgear/terragear /bin/bash

where <host directory> is the directory on your computer that's mounted into the container and <docker directory> is the directory where the computers directory is mounted in. Then to copy files into the docker container, simply move them into the <host directory> on the host operating system and you'll find them in the <docker directory> in the docker container.