Skip to content

Commit aaa8d72

Browse files
authored
Instructions to run the devcontainer locally (#1568)
1 parent c6fa267 commit aaa8d72

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

getting-started/setup-building.rst

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,45 @@ select the option ``Open in VS Code``. You will still be working on the remote
11861186
codespace instance, thus using the remote instance's compute power. The compute
11871187
power may be a much higher spec than your local machine which can be helpful.
11881188

1189-
.. TODO: add docker instructions
1189+
1190+
Building the container locally
1191+
------------------------------
1192+
1193+
If you want more control over the environment, or to work offline,
1194+
you can build the container locally.
1195+
This is meant for users who have (or want to get) some experience
1196+
with containers.
1197+
The following instructions are a starting point for
1198+
your own customizations.
1199+
They assume a Unix-like environment, and Docker or Podman installed.
1200+
1201+
In a clone of the `cpython-devcontainers repo <https://github.com/python/cpython-devcontainers>`_,
1202+
build the container and name it ``cpython-dev``:
1203+
1204+
.. code-block:: bash
1205+
1206+
docker build devcontainer/ --tag cpython-dev
1207+
1208+
(Substitute ``podman`` for ``docker`` if you use Podman.)
1209+
1210+
The same command will update any existing ``cpython-dev`` container.
1211+
Run it again from time to time -- especially if the container stops
1212+
working for you.
1213+
1214+
To run the container, run one of the following commands in a clone of the
1215+
CPython repository.
1216+
1217+
.. code-block:: bash
1218+
1219+
docker run -it --rm --volume $PWD:/workspace --workdir /workspace cpython-dev
1220+
1221+
.. code-block:: bash
1222+
1223+
podman run -it --rm --volume $PWD:/workspace:Z --workdir /workspace cpython-dev
1224+
1225+
Note that the container has read/write access to the working directory.
1226+
You may want to use a separate clone of CPython, or run ``make clean``
1227+
to remove caches and build output generated for your host OS.
11901228

11911229
.. c_codespaces_end
11921230

0 commit comments

Comments
 (0)