Skip to content

Setup Ansible AVD With VS Code Container

Arista AVD provides an easy way to set up a lab or demo environment using a pre-configured VScode container with a web interface to connect and edit files.

We can leverage this container in different ways like a demo, remote lab, training sessions, or development solution. However, on this page, we will focus only on how to play with AVD demo content.

VScode container overview

This container is based on a AVD base image with an installation of VScode server using code-server implementation.

This container comes with a set of options available to let you customize your environment:

Generic settings

  • AVD_MODE: If set to demo, container will install AVD content to test it from (Supported mode: ['demo', 'toi']).
  • AVD_PASSWORD: Allow user to set a password for VScode authentication. If not set, access isn’t protected by any password.
  • AVD_GIT_USER: Username to configure in .gitconfig file.
  • AVD_GIT_EMAIL: Email to configure in .gitconfig file.
  • AVD_USER_EXTENSIONS_FILE: Allow user to install additional VScode extensions.
  • AVD_USER_REPOS: Path to a text file in your container with a list of repository to clone (one repository per line).
  • AVD_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.

  • AVD_UID: Set uid for AVD user in container.
  • AVD_GID: Set gid for AVD user in container.

The container also comes with Docker installed, and in case you want to run Docker from your container, you can expose your local Docker socket from your host to your container:


To run this container, few requirements are expected:

  • Docker installed on a host: laptop, VM, server, or anything that runs Docker
  • Git configured with at least username and email
# Set your user name to display in git commit
$ git config --global "John Doe"

# Set your email address to use in git commit
$ git config --global

Get AVD demo in VSCode

We will ask the container to install the following content in your container automatically:

  • Ansible Arista Validated Design collection using Git (devel) version.
  • Ansible Arista CloudVision collection using Git (devel) version.
  • AVD with CloudVision demo repository


The container will listen on port 8080, but we can be change it accordingly by using Docker CLI

docker run --rm -it -d \
    -e AVD_MODE=demo \
    -e AVD_GIT_USER="$(git config --get" \
    -e AVD_GIT_EMAIL="$(git config --get" \
    -p 8080:8080 \


In this setup, the container will be destroyed after you stop it. Since we don’t share any volumes, all changes will be lost.

Once your container is started, confirm with the following Docker command:

$ docker ps
CONTAINER ID   IMAGE                   COMMAND                  CREATED          STATUS          PORTS                    NAMES
0fd39cc2dd3d   avdteam/vscode:latest   "/bin/"     10 seconds ago   Up 9 seconds>8080/tcp   inspiring_germain

You should be able to connect to your VSCode instance using your favorite browser with the following URL:

http://<IP ADDR of DOCKER Machine>:8080/?folder=/home/avd/arista-ansible

VSCode demo Overview

Customize your container

Once you run your first AVD demo, you may want to not use non-volatile storage or install your repositories.

Mount your local folder

The first option is to mount one of your local folders to save your work from your container. Considering your local folder is empty, you can add this line to your Docker CLI:

-v ${PWD}/:/home/avd/arista-ansible

Complete CLI example below:

docker run --rm -it -d \
    -e AVD_GIT_USER="$(git config --get" \
    -e AVD_GIT_EMAIL="$(git config --get" \
    -v ${PWD}/:/home/avd/arista-ansible \
    -p 8080:8080 \

Install additional repositories

Now, you want to ship your own demo in your container with Git clone instead of local file sharing, you can leverage the following option: AVD_USER_REPOS

docker run --rm -it -d \
    -e AVD_GIT_USER="$(git config --get" \
    -e AVD_GIT_EMAIL="$(git config --get" \
    -e AVD_USER_REPOS=/home/avd/arista-ansible/my_repos.txt \
    -v ${PWD}/:/home/avd/arista-ansible \
    -p 8080:8080 \

And then your my_repos.txt file should be like:


By default, Docker can’t load a file from your host. The path you provide in AVD_USER_REPOS must be configured using a shared volume.

For more details and options, you can check our repository for this container: arista-netdevops-community/docker-avd-vscode

Last update: August 10, 2022