Closed huang-sh closed 2 years ago
Hi @huang-sh the port of the container will remain 8888, if you want to match it to a different port on the host machine you only need to change only the first port like so:
docker run -p 8889:8888 -e PASSWORD="jupyter" quay.io/cellgeni/scrna-seq-course:v5.14
You can read more on port publishing/exposing on the Docker docs: https://docs.docker.com/engine/reference/commandline/run/#publish-or-expose-port--p---expose
Thank you! That is I want.
I am confused that it still show the port 8888 when I run docker run -p 8889:8888 -e PASSWORD="jupyter" quay.io/cellgeni/scrna-seq-course:v5.14
. Anyway, I can access the server with "http://127.0.0.1:8889/lab" now.
$ docker run -p 8889:8888 -e PASSWORD="jupyter" quay.io/cellgeni/scrna-seq-course:v5.14
.........
To access the server, open this file in a browser:
file:///home/jovyan/.local/share/jupyter/runtime/jpserver-7-open.html
Or copy and paste one of these URLs:
http://4dcea16fdc40:8888/lab?token=094efe8f0bdd28438bcd5a8923d2ce3cd60b8553b6a0550b
or http://127.0.0.1:8888/lab?token=094efe8f0bdd28438bcd5a8923d2ce3cd60b8553b6a0550b
I'm glad you can access the server now @huang-sh. What you see in the terminal is running inside the container and —as far as Docker is concern— that's still running on port 8888 of the container.
What you're doing with the -p 8889:8888
is mapping that container port (8888) to a port on your host machine (8889) that's accesible for you. That means when you try to access localhost:8889 that will be routed internally by Docker to the running container's port 8888.
Should you want to know more about port binding you can read this, this or this.
Hi, thank you for providing the wonderful scRNA-Seq learning resource.
I am using the course docker image. I can run the docker image with
But when I use the other port, it still work on port 8888:
I am not familiar with docker. Can I run multiple containers with different ports ?