...
-p maps a network port from the host machine to a port in the container. In the command above, we map YYYY, which should be an unused port number of the host machine, to port 8888 in the container, which is where the default jupyter process will listen.
--name sets a name for the container. It is not needed, since the container also gets a hash ID, but it is good practice to mark it with a human readable string as well. For instance, if you called your image olanorm/myproject, you can call the container olanorm_myproject (since slashes are not allowed in container names). This name can be used to access the container when running extra commands in it or when you wish to shut it down.
The final, positional argument is just the name of the image created in the previous section.
After executing the run command, docker will print the name of the container, or just a hash if you did not specify one. The container is now running and ready, you should be able to see it by executing:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
docker ps |
4 - Connecting to jupyter
Normally, when using jupyter notebook-like apps on a computer, we just run the server and access it through a web browser. However, since the server process is running on a different machine that most likely does not expose the serving port on the network, we need some extra magic to make it accessible. To achieve this, open a new SSH connection to the server that is running your docker container with the following command:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
ssh -L XXXX:localhost:YYYY <username>@<hostname> |
Info |
---|
Related articles
Content by Label | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...