Sign inSign up

titom73/vscode

By titom73

•Updated over 2 years ago

Image
0

366

titom73/vscode repository overview

GitHub Docker Pulls Docker Image Size (tag) Docker Image Version (tag latest semver)

⁠Docker VScode container

⁠About

This repository provides a Docker image running cdr/code-server⁠.

Docker image: titom73/vscode⁠

This image was originally built for Arista Validated Design⁠ with this repository⁠.

⁠Getting started

# Run titom73/vscode container
$ docker run --rm -d -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 titom73/vscode:latest

# Connect to your browser
$ open http://127.0.0.1:8080

As it is for development and local use only, there is no password protection ! Never expose container to untrust or Internet.

⁠Container options

⁠Generic settings
  • VSC_PASSWORD: Allow user to set a password to use for VScode authentication. If not set, access is not protected by any password.
  • VSC_GIT_USER: Username to configure in .gitconfig file.
    • Can be set with VSC_GIT_USER=$(git config --get user.name)
  • VSC_GIT_EMAIL: Email to configure in .gitconfig file.
    • Can be set with VSC_GIT_EMAIL=$(git config --get user.email)
  • VSC_USER_EXTENSIONS_FILE: Allow user to installed additional VScode extensions
  • VSC_USER_REPOS: Path to a text file in your container with a list of repository to clone (1 repository per line)
  • VSC_USER_SCRIPT: Path to a shell script to execute during entrypoint execution.
⁠User settings

These settings must be used to mount and edit file from your physical host.

  • VSC_UID: set uid for avd user in container.
  • VSC_GID: set gid for avd user in container.
⁠Docker in Docker

Current container has docker installed and can be used in a Docker-in-Docker approach. To run docker, you must share your docker socket with container:

Docker Socket on Linux / Macos

-v /var/run/docker.sock:/var/run/docker.sock

Docker Socket on Windows

-v //var/run/docker.sock:/var/run/docker.sock

⁠Examples

⁠Use container to run volatile content
docker run --rm -it -d \
    -e VSC_GIT_USER=titom73 \
    -e [email protected] \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 8080:8080 \
    titom73/vscode:latest
⁠Use container to work on your local version
docker run --rm -it -d \
    -e VSC_GIT_USER=titom73 \
    -e [email protected] \
    -v ${PWD}/your-local-work:/home/vsc/arista-ansible \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 8080:8080 \
    titom73/vscode:latest
⁠Use container with your custom extensions list
docker run --rm -it -d \
    -e VSC_USER_EXTENSIONS_FILE=my_settings/user-extensions.txt \
    -e VSC_GIT_USER=titom73 \
    -e [email protected] \
    -v ${PATH_TO_FOLDER_WITH_EXT_FILE}/tests:/home/vsc/my_settings \
    -v ${PWD}/your-local-work:/home/vsc/arista-ansible \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 8080:8080 \
    titom73/vscode:latest

⁠Deployment Scenario

⁠Docker Compose

Easy to manage TOI and ATD with docker-compose command

# Start single node stack
$ docker-compose up -d
Creating network "avd-vscode_default" with the default driver
Creating avd-vscode_avd-coder_1 ... done

# get dynamic port mapping
$ docker-compose ps
         Name                 Command         State            Ports
-----------------------------------------------------------------------------
avd-vscode_avd-coder_1   /bin/entrypoint.sh   Up      0.0.0.0:55000->8080/tcp

# Scale up environment
$ docker-compose --scale avd-coder=3
Creating avd-vscode_avd-coder_2 ... done
Creating avd-vscode_avd-coder_3 ... done

$ docker-compose ps
         Name                 Command         State            Ports
-----------------------------------------------------------------------------
avd-vscode_avd-coder_1   /bin/entrypoint.sh   Up      0.0.0.0:55000->8080/tcp
avd-vscode_avd-coder_2   /bin/entrypoint.sh   Up      0.0.0.0:55002->8080/tcp
avd-vscode_avd-coder_3   /bin/entrypoint.sh   Up      0.0.0.0:55001->8080/tcp
⁠Kubernetes deployment
$ kubectl apply -f k8s-deployment.yml
deployment.apps/avd-coder-deployment created
service/avd-coder-service created

$ kubectl get service
NAME                TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
avd-coder-service   NodePort   10.152.183.196   <none>        8080:31081/TCP   5s

⁠License

Project is published under Apache 2.0 License⁠

Tag summary

Content type

Image

Digest

sha256:38e38c069…

Size

572.7 MB

Last updated

over 2 years ago

docker pull titom73/vscode