Score:0

Why vscode is not shown when ran from inside the container?

cn flag

Based on this article and this one I realized that I can run GUI apps from within a docker container. And I successfully ran Firefox from a container and saw it and interacted with it in my local environment. Thus I created this Dockerfile to run VS Code:

FROM ubuntu:latest

WORKDIR /Temp

RUN apt-get update

RUN apt install wget -y

RUN wget https://go.microsoft.com/fwlink/?LinkID=760868 -O vscode.deb

RUN ls

RUN apt install ./vscode.deb -y

RUN apt install libxshmfence1 -y

RUN apt install libasound2 -y

RUN apt install firefox -y

CMD [ "code", "--user-data-dir='~/.vscode-root" ]
#CMD ["/usr/bin/firefox"]

Then I built it and tagged it:

docker build -t vscode_image .

However, when I run this image using the following command, it exits immediately:

docker run -it --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" vscode_image

And it prints no error. How can I fix this?

Update: If you switch the last two lines, you see the Firefox is actually shown.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.