Skip to content

Instantly share code, notes, and snippets.

@TylerLeonhardt
Last active January 7, 2018 20:44
Show Gist options
  • Save TylerLeonhardt/1a0cec288e21b98fda576317b8bcb106 to your computer and use it in GitHub Desktop.
Save TylerLeonhardt/1a0cec288e21b98fda576317b8bcb106 to your computer and use it in GitHub Desktop.
A crazy dockerfile for testing the PowerShell extension for VSCode on CentOS - using CentOS 7, xfce, vnc, PowerShell, VSCode
FROM consol/centos-xfce-vnc
USER root
# Get PowerShell
RUN sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc.2/powershell-6.0.0_rc.2-1.rhel.7.x86_64.rpm -y
# Get git
RUN sudo yum install git -y
# Get VSCode
RUN sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc && \
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' && \
yum update -y && \
sudo yum install code -y
# Set to non-root user
RUN useradd -G wheel docker
RUN echo "root" | passwd docker --stdin
RUN sudo chown -R docker: $HOME
USER docker
# Install PowerShell extension
RUN code --install-extension ms-vscode.powershell
# Steps:
# download this docker file to a directory
# cd into that directory
# docker build . -t vscode-powershell-centos-devkit:0.0.1 -f VSCodePowerShellCentOSDockerfile
# docker run -it -p 5901:5901 vscode-powershell-centos-devkit:0.0.1
# Open up your favorite VNC client and connect to localhost:5901
# The default vnc connection password is vncpassword
# The default user "docker" has a password of "root"
# You're ready to go!
# Will be on Docker Hub soon!
@TylerLeonhardt
Copy link
Author

TylerLeonhardt commented Jan 5, 2018

Ah! Just saw this. I added the default password in the Dockerfile :)

@TylerLeonhardt
Copy link
Author

Also I don't seem to get notifications when people post here - if you have trouble, find me on Twitter (@TylerLeonhardt) 🙂

@bahreex
Copy link

bahreex commented Jan 6, 2018

While trying to run, I am getting the error:
docker run -it -p 5901:5901 vscode-powershell-centos-devkit:0.0.1
Unable to find image 'vscode-powershell-centos-devkit:0.0.1' locally
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: pull access denied for vscode-powershell-centos-devkit, repository does not exist or may require 'docker login'.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

@bahreex
Copy link

bahreex commented Jan 6, 2018

when doing docker build, I get following output, returning a non-zero code:
docker build . -t vscode-powershell-centos-devkit:0.0.1 -f VSCodePowerShellCentOSDockerfile
Sending build context to Docker daemon 3.072kB
Step 1/10 : FROM consol/centos-xfce-vnc
---> c663163597b0
Step 2/10 : USER root
---> Using cache
---> 93de26fc3be0
Step 3/10 : RUN sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc.2/powershell-6.0.0_rc.2-1.rhel.7.x86_64.rpm -y
---> Using cache
---> e01b7935ca99
Step 4/10 : RUN sudo yum install git -y
---> Using cache
---> d2298b954d8f
Step 5/10 : RUN sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc && sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' && yum check-update && sudo yum install code -y
---> Running in 7916970b4e63
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile

  • base: centos.excellmedia.net
  • epel: kartolo.sby.datautama.net.id
  • epel-testing: kartolo.sby.datautama.net.id
  • extras: centos.excellmedia.net
  • updates: centos.excellmedia.net

dracut.x86_64 033-502.el7_4.1 updates
The command '/bin/sh -c sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc && sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' && yum check-update && sudo yum install code -y' returned a non-zero code: 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment