The article linked by Hooray tells how to build a docker image.
You already have pulled the docker image! No need to rebuild it!Some definitions:
- a docker
image is similar to a snapshot of a virtual machine: something static, frozen in time you can always reload to have a clean environment. "flightgear/terragear" is a docker image.
- a docker
container is an image that has been started. When you run the image "flightgear/terragear", you have a (by default, randomly named) container in your PC, similar to an isolated virtual machine. Usually, when a container ends, it is deleted and the image is ready to be run again to create a new, clean container.
Now, create and map the input and output directories and enter the docker container:
1. create a "myscenery" directory and any files or directories you need. For example: save your shapes in an input "input" directory, in "output" you'll find the scenery, after you build it!
- Code: Select all
mkdir myscenery
cd myscenery
mkdir input output
2. Run this command (maybe, with sudo). This command maps the current directory (hopefully, "myscenery") to the myscenery directory in the container, and then enters the container
- Code: Select all
docker run --rm -ti -v $(pwd):/home/flightgear/myscenery flightgear/terragear bash
Explanation: "docker run OPTIONS IMAGE COMMAND".
- The image "flightgear/terragear" is the name you just pulled (not even necessary pulling before running: docker automatically downloads the image if you have not pulled it yet)
- OPTIONS are:
--rm (delete the container after using it);
-ti create an interactive terminal and
-v EXTERNAL:INTERNAL maps an external directory to an internal directory.
- We run bash in the internal container.
bash is the default command in this specific image, but I like to say "run bash" explicitly because bash is usually NOT the default command for most images.
3. The image ""flightgear/terragear" is based on Ubuntu, but terragear, simgear and some geo tools are already built and installed. Run ogr2ogr, genapts, tg-build.... the commands described in the wiki, using the files and directories in "myscenery" for input, working and output directories.
We have only mapped "myscenery", and this means any change or new file outside the internal "myscenery" directory will be lost when you exit the container! For example: you can install any additional program you need inside the container, but it won't be there if you exit the container and run again. Only files in "myscenery" will be kept between executions. This also means you can't break anything: exit, run again and you'll have a clean environment.
4. When satisfied, exit with "exit"