Docker - Cant access docker port 8080 even if is exposed. Works only with --network host

883 views Asked by At

I'm trying to run a visual studio server and create a dockerfile. If you want to reproduce the script clone https://github.com/alessandriLuca/4Stackoverflow . script.sh will build the docker container and run it sharing the port. The problem is that apparently i cant reach the port 8080 even if i exposed it. I solved on ubuntu with --network host but this option is not accessible for OsX or Windows.

Here is the last part of the dockerfile, that is related to visualStudio installation

COPY visualStudio /visualStudio
RUN cd /visualStudio/ && 7za -y x "*.7z*"
RUN dpkg -i /visualStudio/visualStudio/*.deb
COPY config.yaml ~/.config/code-server/config.yaml
EXPOSE 8080
CMD ["code-server","--auth","none"]

As you can see i use a config.yaml but that one is also not working since when i run the code-server that file is overwritten so, the port still remain 8080.

Thank you for any help

EDIT You can find all files, included config.yaml here https://github.com/alessandriLuca/4Stackoverflow/tree/main/merged2_visualStudio

EDIT I kind of solved it! Practically as you said was hosting on 127.0.0.1 instead of 0.0.0.0, soo i changed manually in config.yaml and now is working. The only problem now is to add this configuration directly in the dockerfile since, when I run the server he overwrite the config.yaml that I created. Does someone have any idea about this part?

0

There are 0 answers