How to install code server and how to configure it

How to install code server and how to configure it
Code server is a VS Code instance that we can deploy in one machine, on this time we will use docker to deploy and configure it. If you want to know more about it you can visit the project page

Pre requisites:

  • Docker installed on the environment.
  • Docker Compose installed the environment.
  • A Machine with a Linux SO.

Well let's start, the first thing that we need to do is create a Docker compose file configuration we will use this configuration:

version: '3'

      - ./config:/config
    container_name: code-server
    restart: unless-stopped
      - 8443:8443
      PUID: 1000
      PGID: 1000
      TZ: ${TIME_ZONE}

The name of the file should be docker-compose.yml.

After that we need to create the file that contains the environment variables it will be called .env (you can use vim or nano to create the file) and the content will be:


This configuration is the basic configuration we'll add more configuration later.

Configuration explanation:

  • TIME_ZONE: It is the time zone for configure the terminal date and time in the example the terminal will use a UTC-04 time zone.

The next step is the password generation for web access and for sudo permissions.

1. Generate the web access password using
echo -n "my_web_password" | npx argon2-cli -e

After the command finished we can see a response like this


On the next step add the hashed password to the .env file

Be careful when you add the hashed password, you  need to add it between quotes.
2. Generate the sudo password using
echo -n "my_sudo_password" | npx argon2-cli -e

The command generates another hashed password


And you need to add it to the .env file again, the .env file should looks like this


The next step is raise up the docker container using

docker-compose up

If everything is running well you can see this screen in the console

After check that we can continue entering to the GUI, we'll go to http://localhost:8443 and we can see this screen. To sign in we need to use the web password that we generated before

If your password is correct you can see the IDE screen

And that it's all, on a next post I will explain how to configure the git credentials, the user sudo and how to install and use docker inside this container.

Best Regards.