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
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.
Copy file name to clipboardExpand all lines: README.md
+10-24Lines changed: 10 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -965,35 +965,21 @@ export NVM_DIR="$HOME/.nvm"
965
965
966
966
## Docker For Development Environment
967
967
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 imagewith 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:
969
969
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.
975
972
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
990
976
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].
992
978
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.
0 commit comments