Skip to content

Commit

Permalink
eclipse-sumo#15861 Improve formulations on dockerized SUMO
Browse files Browse the repository at this point in the history
Signed-off-by: Kilian Krampf <[email protected]>
  • Loading branch information
Menkalian committed Jan 14, 2025
1 parent dac7bcc commit cc0cf66
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 34 deletions.
13 changes: 6 additions & 7 deletions docs/web/docs/Developer/Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ title: Docker

Building and installing SUMO from source is not an easy task for beginner users.
Docker is a popular tool to solve this issue.
SUMO provides [Dockerfiles](https://github.com/eclipse-sumo/sumo/blob/main/build_config/docker)
and [prebuilt Docker images](https://github.com/eclipse-sumo/sumo/pkgs/container/sumo/versions) to use.
SUMO provides [Dockerfiles](https://github.com/eclipse-sumo/sumo/blob/main/build_config/docker) and [prebuilt Docker images](https://github.com/eclipse-sumo/sumo/pkgs/container/sumo/versions) to use.

### Available Dockerfiles

There are several Dockerfiles available in the SUMO repository.
To build them check out [the SUMO repository](https://github.com/eclipse-sumo/sumo) and use the following command whilst
in the `build_config/docker` directory of the repository:
To build them, check out [the SUMO repository](https://github.com/eclipse-sumo/sumo) and use the following command while in the `build_config/docker` directory of the repository:

```shell
docker build -f {NAME_OF_DOCKERFILE} .
```

!!! note
Mind the dot at the end of the command
Ensure to include the dot at the end of the command.

The following Dockerfiles containing SUMO are available:

Expand Down Expand Up @@ -69,5 +67,6 @@ A quick example for running a prepared simulation looks like this:
A use-case for this could be preparing the simulation data on a computer with SUMO installed and then running the simulation on a server without needing to install SUMO.

The container images also contains the graphical applications.
There are ways to use them, but these are highly dependent on your individual setup (OS, X/Wayland).
Therefor we can not give specific instructions here.
However, configuring them for use depends on your operating system and graphical environment (e.g., X11, Wayland).
For guidance, consult Docker's documentation on GUI application forwarding.
Therefore, we cannot provide specific instructions here.
15 changes: 4 additions & 11 deletions docs/web/docs/Installing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,7 @@ you need several additional python modules. The easiest way to install them is t

# via Docker

Building and installing SUMO from source is not an easy task for
beginner users. Docker is a popular tool to solve this issue. Searching
"SUMO" at [Docker Hub](https://hub.docker.com) will give several results
from existing attempts at Dockerising SUMO.

The solution given at
[docker-sumo](https://github.com/bogaotory/docker-sumo) demonstrates how
to Dockerise SUMO version 0.30.0 on top of Ubuntu 16.04. As well as
**sumo** and **traci**, the use of **sumo-gui** is also demonstrated by
[docker-sumo](https://github.com/bogaotory/docker-sumo) so that the
users have access to the graphical interface of a Dockerised SUMO.
Building and installing SUMO from source is not an easy task for beginner users.
Docker is a popular tool to solve this issue.
SUMO provides [Dockerfiles](https://github.com/eclipse-sumo/sumo/blob/main/build_config/docker) and [prebuilt Docker images](https://github.com/eclipse-sumo/sumo/pkgs/container/sumo/versions) to use.
For more details check out [the documentation on dockerized SUMO](../Developer/Docker.md) or [the tutorial on dockerized SUMO](../Tutorials/Containerized_SUMO.md).
29 changes: 13 additions & 16 deletions docs/web/docs/Tutorials/Containerized_SUMO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,30 @@ This tutorial shows how to use SUMO to run simulations inside a docker container

## Introduction

This tutorial shows how to use SUMO for running simulations when you do not want to install the software on your local
machine.
This tutorial demonstrates how to use SUMO for running simulations without installing the software on your local machine.

It is also possible to run the GUI applications from the docker container.
The way to do this is highly dependent on your individual setup, so we will not provide the required
configuration/commands.
The way to do this is highly dependent on your individual setup, so we will not provide the required configuration or commands.

## Getting the docker image

You can either get the latest docker image from our docker registry by using
You can either get the latest docker image from the SUMO docker registry by using

```shell
docker pull ghcr.io/sumo-eclipse/sumo:main
docker pull ghcr.io/eclipse-sumo/sumo:main
```

or build your own local version of the image by checking out the [SUMO repository](https://github.com/eclipse-sumo/sumo)
and executing:
or build your own local version of the image by checking out the [SUMO repository](https://github.com/eclipse-sumo/sumo) and executing:

```shell
cd build_config/docker
docker build -t ghcr.io/sumo-eclipse/sumo:main -f Dockerfile.ubuntu.git .
docker build -t ghcr.io/eclipse-sumo/sumo:main -f Dockerfile.ubuntu.git .
```

## Creating simulation files

For this tutorial we use the simulation files from the [Hello SUMO Tutorial](Hello_SUMO.md).
Check out that tutorial to learn about the purpose of the files.

Create a directory called `hello_sumo_docker` and in it create 3 files:

Expand Down Expand Up @@ -68,7 +66,6 @@ Create a directory called `hello_sumo_docker` and in it create 3 files:
#### `hello.rou.xml`

```xml

<routes>
<vType accel="1.0" decel="5.0" id="Car" length="2.0" maxSpeed="100.0" sigma="0.0"/>
<route id="route0" edges="1to2 out"/>
Expand All @@ -95,22 +92,22 @@ Create a directory called `hello_sumo_docker` and in it create 3 files:
## Running the simulation

To run the simulation start a new container from the image and mount the directory in there with the `-v`-Option.
Also add `--full-output result.xml` to the SUMO command, to get the result of the simulation.
Add `--full-output result.xml` to the SUMO command to get the result of the simulation.
The command to start the container might look like this:

```shell
# Replace this with the location your simulation files are located.
# Replace this with the location where your simulation files are located.
export SIMULATION_FILES_DIR=$PWD

docker run \
--rm \
-v $SIMULATION_FILES_DIR:$SIMULATION_FILES_DIR
ghcr.io/sumo-eclipse/sumo:main \
-v $SIMULATION_FILES_DIR:$SIMULATION_FILES_DIR \
ghcr.io/eclipse-sumo/sumo:main \
sumo --configuration-file $SIMULATION_FILES_DIR/hello.sumocfg --full-output $SIMULATION_FILES_DIR/result.xml
```

This will run the simulation specified in `hello.sumocfg`.
After that a file named `result.xml` will have been created, which contains
After that, a file named `result.xml` will have been created, which contains the output of the simulation.

## Further Reading

Expand Down

0 comments on commit cc0cf66

Please sign in to comment.