Skip to content

Commit bd5b1be

Browse files
committed
README §Docker: Improve "Docker for Development Environment" section
* 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.
1 parent 6c34cec commit bd5b1be

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

README.md

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -965,35 +965,21 @@ export NVM_DIR="$HOME/.nvm"
965965
966966
## Docker For Development Environment
967967
968-
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:
968+
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:
969969
970-
```sh
971-
$ docker build -t nvm-dev .
972-
```
973-
974-
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`:
970+
docker build -t nvm-dev . # Create the nvm-dev image
971+
docker images # Confirm nvm-dev appears in the list.
975972
976-
```sh
977-
$ docker images
978-
979-
REPOSITORY TAG IMAGE ID CREATED SIZE
980-
nvm-dev latest 9ca4c57a97d8 7 days ago 650 MB
981-
```
982-
983-
If you got no error message, now you can easily involve in:
984-
985-
```sh
986-
$ docker run -h nvm-dev -it nvm-dev
987-
988-
nvm@nvm-dev:~/.nvm$
989-
```
973+
# Create a container named `nvm-dev` (with the same hostname)
974+
# and enter an interactive session in it.
975+
docker run --name nvm-dev -h nvm-dev -it nvm-dev
990976
991-
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.
977+
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].
992978
993-
For more information and documentation about docker, please refer to its official website:
979+
Note that the build takes several minutes and well over half a gigabyte of disk space, so it's not suitable for production usage.
994980
995-
- https://www.docker.com/
996-
- https://docs.docker.com/
981+
[dr-docs]: https://docs.docker.com/
982+
[dr-web]: https://www.docker.com/
997983
998984
## Problems
999985

0 commit comments

Comments
 (0)