From 0017af6a2a55d105b3bce521c9fee1feabc7ece7 Mon Sep 17 00:00:00 2001 From: "Curt J. Sampson" Date: Mon, 15 Sep 2025 08:20:51 +0000 Subject: [PATCH 1/4] =?UTF-8?q?README=20=C2=A7Docker:=20Base=20image=20is?= =?UTF-8?q?=20now=20Ubuntu=2022.04,=20not=2018.04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 53edac71a5..b3a1061fd1 100644 --- a/README.md +++ b/README.md @@ -965,7 +965,7 @@ export NVM_DIR="$HOME/.nvm" ## Docker For Development Environment -To make the development and testing work easier, we have a Dockerfile for development usage, which is based on Ubuntu 18.04 base image, prepared with essential and useful tools for `nvm` development, to build the docker image of the environment, run the docker command at the root of `nvm` repository: +To make the development and testing work easier, we have a Dockerfile for development usage, which is based on an Ubuntu 22.04 base image, prepared with essential and useful tools for `nvm` development, to build the docker image of the environment, run the docker command at the root of `nvm` repository: ```sh $ docker build -t nvm-dev . From 430e89ea52865cf4f87ea8b9fb7606edf6411302 Mon Sep 17 00:00:00 2001 From: "Curt J. Sampson" Date: Mon, 15 Sep 2025 17:47:57 +0900 Subject: [PATCH 2/4] Dockerfile: Remove mirror site setting; it broke the build The ubuntu.cs.utah.edu mirror appears to be obsolete; trying to use it produces error messages along the lines of: Ign:2 https://ubuntu.cs.utah.edu/ubuntu jammy-updates InRelease Err:2 https://ubuntu.cs.utah.edu/ubuntu jammy-updates InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 155.98.64.89 443] W: http://ubuntu.cs.utah.edu/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates. These messages don't make it completely obvious what the problem is, and it's also a rather obscure setting; you have to carefully read the Dockerfile to find it. Due to issues like this, and changing mirrors over time, it's best just to drop attempts to use a specific mirror and use whatever the default you get for archive.ubuntu.com etc. The package downloads generally happen only once per host, anyway, since Docker will keep not only the final image, but also the layers used to generate it: if the final image is deleted or anything in the Dockerfile after the OS package updates is changed, these cached layers will be used. --- Dockerfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 97ff98ccb6..449348c2a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,14 +20,6 @@ ENV DEBIAN_FRONTEND noninteractive # ShellCheck version ENV SHELLCHECK_VERSION=0.7.0 -# Pick a Ubuntu apt mirror site for better speed -# ref: https://launchpad.net/ubuntu/+archivemirrors -ENV UBUNTU_APT_SITE ubuntu.cs.utah.edu - -# Replace origin apt package site with the mirror site -RUN sed -E -i "s/([a-z]+.)?archive.ubuntu.com/$UBUNTU_APT_SITE/g" /etc/apt/sources.list -RUN sed -i "s/security.ubuntu.com/$UBUNTU_APT_SITE/g" /etc/apt/sources.list - # Install apt packages RUN apt update && \ apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" && \ From 6c34cecd910e753fb2501ac1520609e4db5340be Mon Sep 17 00:00:00 2001 From: "Curt J. Sampson" Date: Mon, 15 Sep 2025 18:06:37 +0900 Subject: [PATCH 3/4] =?UTF-8?q?README=20=C2=A7Docker:=20Build=20time=20is?= =?UTF-8?q?=20"several"=20minutes,=20not=20eight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On my system, even without using local mirrors, the build is only two minutes, even though I have only a 1 Gbps Internet connection and I'm half-way across the world in Tokyo. There probably are still users with much slower Internet connections where the build could take eight minutes or more, but "several" still covers that. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3a1061fd1..fa336cf9a3 100644 --- a/README.md +++ b/README.md @@ -988,7 +988,7 @@ $ docker run -h nvm-dev -it nvm-dev nvm@nvm-dev:~/.nvm$ ``` -Please note that it'll take about 8 minutes to build the image and the image size would be about 650MB, so it's not suitable for production usage. +Please note that it'll take several minutes to build the image and the image size would be about 650MB, so it's not suitable for production usage. For more information and documentation about docker, please refer to its official website: From 19efb4759a9c6b5fcbec38440982031ce97ddcec Mon Sep 17 00:00:00 2001 From: "Curt J. Sampson" Date: Mon, 15 Sep 2025 18:22:14 +0900 Subject: [PATCH 4/4] =?UTF-8?q?README=20=C2=A7Docker:=20Improve=20"Docker?= =?UTF-8?q?=20for=20Development=20Environment"=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add `--name` to `docker run` command to make the container easier to manipulate. (This will produce collisions if two developers both try this on the same system, but it's not worth a lot of extra documentation to try to sort out the few developers who can't figure out what's going on from the error messages.) * Explain better that the current repo and working copy are copied to ~/.nvm/ inside the container. * Explain that the container is not deleted when you exit, and how to re-enter and delete it. * General improvements to the language. --- README.md | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index fa336cf9a3..7de716bdd6 100644 --- a/README.md +++ b/README.md @@ -965,35 +965,22 @@ export NVM_DIR="$HOME/.nvm" ## Docker For Development Environment -To make the development and testing work easier, we have a Dockerfile for development usage, which is based on an Ubuntu 22.04 base image, prepared with essential and useful tools for `nvm` development, to build the docker image of the environment, run the docker command at the root of `nvm` repository: - -```sh -$ docker build -t nvm-dev . -``` - -This will package your current nvm repository with our pre-defined development environment into a docker image named `nvm-dev`, once it's built with success, validate your image via `docker images`: - -```sh -$ docker images - -REPOSITORY TAG IMAGE ID CREATED SIZE -nvm-dev latest 9ca4c57a97d8 7 days ago 650 MB -``` - -If you got no error message, now you can easily involve in: - +To make the development and testing work easier, we have a Dockerfile for development usage. This is an Ubuntu 22.04 base image with some development tools added and a copy of this repo (including the current working copy) copied to `~/.nvm/` in the image. To build and use it, `cd` to the root of this repo and: ```sh -$ docker run -h nvm-dev -it nvm-dev +docker build -t nvm-dev . # Create the nvm-dev image +docker images # Confirm nvm-dev appears in the list. -nvm@nvm-dev:~/.nvm$ +# Create a container named `nvm-dev` (with the same hostname) +# and enter an interactive session in it. +docker run --name nvm-dev -h nvm-dev -it nvm-dev ``` -Please note that it'll take several minutes to build the image and the image size would be about 650MB, so it's not suitable for production usage. +This will place you in the container in the `~/.nvm/` directory as the `nvm` user. When you exit the container will not be deleted (so as to avoid losing any work in it); you can re-enter the container with `docker start -i nvm-dev` or delete it permanently with `docker container rm -f nvm-dev`. (For more information on using Docker, see the [website][dr-web] and [documentation][dr-docs]. -For more information and documentation about docker, please refer to its official website: +Note that the build takes several minutes and well over half a gigabyte of disk space, so it's not suitable for production usage. - - https://www.docker.com/ - - https://docs.docker.com/ +[dr-docs]: https://docs.docker.com/ +[dr-web]: https://www.docker.com/ ## Problems