Streamlit Docker tutorial throwing error: "unknown instruction" for port and address commands

I am am attempting to follow the Streamlit Docker tutorial on my local machine. I have copied and pasted the Dockerfile verbatim and am running the docker build -t streamlit . from the same directory as the Dockerfile.

This command returns the following error.

[+] Building 0.1s (2/2) FINISHED                           docker:desktop-linux
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load build definition from Dockerfile                       0.1s
 => => transferring dockerfile: 536B                                       0.0s
  21 |
  22 |     ENTRYPOINT ["streamlit", "run", "", "--server.port=8501",
  23 | >>> "--server.address="]
  24 |
ERROR: failed to solve: dockerfile parse error on line 23: unknown instruction: "--server.address="]

It appears that Docker is unable to understand the --server.address= argument to streamlit in the ENTRYPOINT statement. On other attempts (with my own toy code), it threw a similar error for --server.port=8501. I am running Python version 3.9.

Hi @stat_is_quo

According to the error message, it seems that --server.address="] (line 23) is on a subsequent line from line 22, can you ensure that they are on the same line

[quote=β€œstat_is_quo, post:1, topic:54062”].

  22 |     ENTRYPOINT ["streamlit", "run", "", "--server.port=8501",
  23 | >>> "--server.address="]


Hope this helps

Omg thank you @dataprofessor! :see_no_evil:

Also, one clarification if I may - using port 8501 in the Dockerfile would be port 8501 on the Docker container itself, is that correct? I’m trying to grok why we need to both set the port in the Dockerfile and then either run docker run -p 8501:8501 streamlit or set the host port in optional settings when running from Docker Desktop.

From my playing around just now, it looks like the two ports don’t need to be the same (e.g., I can run on localhost:8502 while having the Dockerfile configured to 8501 for 8502:8501), so the above is my best guess of what is happening.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.