README.md 2.95 KB
Newer Older
1
2
# Docker for openCARP

Axel Loewe's avatar
Axel Loewe committed
3
## What is shipped
Yung-Lin Huang's avatar
Yung-Lin Huang committed
4

5
The docker image contains openCARP ecosystem with the required dependencies:
Yung-Lin Huang's avatar
Yung-Lin Huang committed
6
7
* [openCARP](https://git.opencarp.org/openCARP/openCARP)
* [carputils](https://git.opencarp.org/openCARP/carputils)
8
* [experiments](https://git.opencarp.org/openCARP/experiments)
9
* [meshtool](https://bitbucket.org/aneic/meshtool/src/master/)
Yung-Lin Huang's avatar
Yung-Lin Huang committed
10

11
12
## Installation

13
See [INSTALL.md](https://git.opencarp.org/openCARP/openCARP/blob/master/docker/INSTALL.md)
14
15
16

## Usage

17
The script enables you to start with the keyword `opencarp-docker`, and followed by different commands.
18

19
You can run all openCARP programs, tools, and python codes using carputils in your working directories:
20

21
22
23
    opencarp-docker bench -help
    opencarp-docker openCARP
    opencarp-docker python <your_python_code>
24

25
You can also start a openCARP shell (based on Ubuntu 18.04) in your working directory:
26

27
    opencarp-docker shell
28

29
## For developers
30

31
The script also provides you some developer commands.
32

33
If you want to build the docker image by yourself, enter the codebase directory `openCARP` and then build it:
34

35
    cd <path-to-your-codebase>/openCARP
36
    opencarp-docker build
37

38
You can run all required tools for openCARP development in your working directories:
39

40
41
42
    opencarp-docker make
    opencarp-docker cmake
    opencarp-docker clang-format <source_file>
43

44
For example, enter the codebase directory `openCARP`, use cmake to compile and then run the openCARP:
45

46
    cd <path-to-your-codebase>/openCARP
47
48
49
    opencarp-docker cmake -S. -B_build
    opencarp-docker cmake --build _build
    opencarp-docker _build/bin/openCARP
50

51
You can also start a shell (based on Ubuntu 18.04) in the codebase directory `openCARP` and then run the tools:
52

53
    cd <path-to-your-codebase>/openCARP
54
    opencarp-docker shell
55
56
57
58
    cmake -S. -B_build
    cmake --build _build
    _build/bin/openCARP

59
## More docker commands
60

61
Our script provides a simpler way to utilize the docker images, but if you prefer, you can type docker commands by yourself.
62
63
In the following, we list some docker commands which would be useful for you.

64
Pull the docker images:
65

Yung-Lin Huang's avatar
Yung-Lin Huang committed
66
    docker pull docker.opencarp.org/opencarp/opencarp:latest
67

68
On the other hand, you can build your own docker images based on the Dockerfiles.
69
Enter the codebase directory `openCARP`:
70

71
    cd <path-to-your-codebase>/openCARP
72
73
74
75
76
77
78
79
    docker build -t opencarp . -f docker/Dockerfile

Show docker images in your machine:

    docker images

Run docker shell in an isolated container:

Yung-Lin Huang's avatar
Yung-Lin Huang committed
80
    docker run -it opencarp
81
82
83

Run docker shell with mounting files in your machine:

Yung-Lin Huang's avatar
Yung-Lin Huang committed
84
    docker run -it -v /path/in/your/machine:/path/in/container opencarp
85
86
87
88
89
90
91
92
93
94
95
96

Show running docker container information (including containerID):

    docker ps

Copy files between the docker container and your machine:

    docker cp <containerID>:/path/in/container/source /path/in/your/machine/target
    docker cp /path/in/your/machine/source <containerID>:/path/in/container/target

Clean dangling docker stuff:

97
    docker system prune