Note: Since the desktop entry uses pkexec, docker needs to be run non-interactively, i.e., without i option. To create a shortcut, run nano ~/.local/share/applications/sktopĮxec=bash -c 'pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/docker run -rm -t -net=host -e DISPLAY=:0 myimage' Since docker needs sudo privileges to run, you can use pkexec inside the desktop entry. Visual Studio Code has been installed on your Ubuntu machine. If you get (code:1): Gtk-WARNING **: cannot open display: :0 To install the VS Code snap, open your terminal ( Ctrl+Alt+T) and run the following command: sudo snap install -classic code That’s it. Run the container using: sudo docker run -rm -ti -net=host -e DISPLAY=:0 myimage RUN apt install -no-install-recommends -y libasound2ĬMD /usr/share/code/code -no-sandbox -unity-launchīuild the container: sudo docker build -t myimage. RUN apt install -no-install-recommends -y libxtst6 RUN apt install -no-install-recommends -y libx11-xcb1 RUN apt install -no-install-recommends -y code RUN apt-key adv -keyserver -recv-keys EB3E94ADBE1229CF RUN echo "deb stable main" > /etc/apt//vscode.list If you're concerned about running Visual Studio Code in a sandbox, snaps and AppImages would be a better option.īut if you're still interested in running Visual Studio Code inside a Docker container, you can follow below steps: Preparing the docker containerĬreate a new Dockerfile inside an empty folder, for example, "myimage" and add FROM ubuntu:20.04 As pLumo has already stated that docker isn't made for this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |