You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will start the container and open a `bash` shell in it.
66
-
From this shell you can build and run maxine.
67
-
68
-
To exit the shell and stop the container type `Ctrl-D`.
69
-
70
-
## Keeping your data on the host in sync with your data on the docker container
71
-
72
-
If you use the container for development purposes you most probably will be interested in editing the source code locally and building and running on the docker container.
73
-
To automatically synchronize your files from the host to the container use:
This will create a container named ``maxine-dev``.
47
-
48
-
- ``-u=$(id -u):$(id -g)`` instructs docker to write and read files as the current user instead of root which is the default.
49
-
- ``--mount src="$(pwd)",target="/maxine-src",type=bind`` essentially mounts the current directory to the docker container under the `/maxine-src` directory.
50
-
Similarly, `--mount src="$HOME/.mx",target="/.mx",type=bind` does the same for the `~/.mx` directory.
51
-
Any changes performed to mounted folders outside the docker container are visible in the container and vice versa.
52
-
- ``--mount src="/tmp/.X11-unix",target="/tmp/.X11-unix",type=bind`` mounts the host X11 socket to the container socket.
53
-
- ``-e DISPLAY=unix$DISPLAY`` passes in the ``DISPLAY`` environment variable.
54
-
- ``--cap-add=SYS_PTRACE`` enables ``ptrace`` capability for the container.
55
-
- ``--name maxine-dev`` names the new image so that it can later be referenced (to start it, stop it, attach to it etc.).
56
-
- ``-ti`` instructs docker to create an interactive session with a pseudo-tty, to allow us to interact with the container.
57
-
58
-
macOS
59
-
~~~~~
60
-
61
-
On macOS unfortunately simply mounting host directories on docker containers, although functional, is slow.
62
-
As an alternative we run an rsync daemon on the docker container and rsync the source code from the host to the container.
29
+
Developing using a docker container
30
+
-----------------------------------
63
31
64
-
To create a docker container from the ``beehivelab/maxine-dev`` docker image run::
32
+
On macOS (and Windows) unfortunately simply mounting host directories on docker containers, although functional, is slow.
33
+
To work arround this issue we use `docker-sync <https://docker-sync.readthedocs.io/en/latest/index.html>`__.
34
+
Additionally we run an rsync daemon on the docker container, this way users that don't want to use docker-sync can manualy rsync files from the host to the container and vice versa (through ``rsync://localhost:9873/root`` which maps to ``/root/`` on the container).
65
35
66
-
docker create \
67
-
-p 9873:873 \
68
-
--cap-add=SYS_PTRACE \
69
-
--name maxine-dev -ti beehivelab/maxine-dev
36
+
To create a docker container named ``maxine-dev`` from the ``beehivelab/maxine-dev`` docker image enter ``maxine-src/maxine/docker`` and run::
70
37
71
-
This will create a container named ``maxine-dev``.
38
+
docker-compose up --no-start
72
39
73
-
- ``-p 9873:873`` maps port 9873 of the host to port 873 of the docker container.
74
-
- ``--cap-add=SYS_PTRACE`` enables ``ptrace`` capability for the container.
75
-
- ``--name maxine-dev`` names the new image so that it can later be referenced (to start it, stop it, attach to it etc.).
76
-
- ``-ti`` instructs docker to create an interactive session with a pseudo-tty, to allow us to interact with the container.
40
+
Note that the container is now created but does not contain the source code.
77
41
78
-
Initializing the container
79
-
''''''''''''''''''''''''''
80
-
81
-
Then start the container (on a different terminal) with::
82
-
83
-
docker start -i maxine-dev
84
-
85
-
Return back to the main terminal and copy the ``maxine-src`` directory to the container using::
0 commit comments