diff --git a/doc/hacking/using-docker.rst b/doc/hacking/using-docker.rst index 3c5b8f749f..30cea6ee28 100644 --- a/doc/hacking/using-docker.rst +++ b/doc/hacking/using-docker.rst @@ -23,11 +23,15 @@ Building the Docker image First you will need to obtain the NAV source code. -The source contains a configuration file for `Docker Compose`_ to build a -suite of containers for PostgreSQL, Graphite and NAV itself. Simply run this -command to build and run everything:: +The source contains a configuration file for `Docker Compose`_ to build a suite +of containers for PostgreSQL, Graphite and NAV itself. These definitions +contain everything needed to run and develop NAV directly from the checked out +source code. - docker-compose up +In order to build the container images successfully the first time, use this +command:: + + make docker .. Tip:: The first time you run this would be the perfect time to grab some coffee (and maybe redecorate your living room), as the initial build @@ -37,12 +41,16 @@ command to build and run everything:: Using the container(s) ---------------------- -The Docker Compose specificiation creates these containers (called "services" -in Docker Compose lingo): +The Docker Compose specificiation creates several containers (called "services" +in Docker Compose lingo). Several of them will mount the checked out source +code directory internally on the `/source` directory, allowing them to always +be up-to-date with the latest changes you are making in your favorite editor. + +These are the defined services: nav This container runs the NAV backend processes and cron jobs. It also runs the - "sass-watcher" job, which will watch ``*.scss`` files for modifications and + ``sass-watcher`` job, which will watch ``*.scss`` files for modifications and recompile NAV's CSS when changes do occur. web @@ -74,21 +82,21 @@ NAV daemons using the ``nav`` command, adjust the running config, or whatever) by running a bash shell inside the container, like so (for the ``nav`` container):: - docker-compose exec nav /bin/bash + docker compose exec nav /bin/bash Manually restarting the web server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To manually restart the web server, all you need is:: - docker-compose restart web + docker compose restart web Rebuilding the NAV code from scratch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A complete rebuild of the NAV code can be initiated by:: - docker-compose restart nav + docker compose restart nav Rebuilding the containers ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -98,7 +106,17 @@ images the containers are based on (as different development branches may have different requirements, and therefore different Dockerfiles). Stop the existing containers and run this:: - docker-compose build + docker compose build --build-arg UID=$UID --build-arg GID=$GID + +The ``UID`` and ``GID`` arguments are there to ensure that the unprivileged +user created inside the container will match your user's UID and GID on your +local system, so that any files the containers create in the mounted source +code directories are owned by you, and not by some other user id (like +``root``). + +A quicker rebuild can be achieved by :kbd:``make docker``: This will +automatically fetch your ``UID`` and ``GID`` and insert them into the above +command. Controlling processes inside the nav container