Skip to content

Latest commit

 

History

History

.devcontainer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Development container

Development container that can be used with VSCode.

It works on Linux, Windows and OSX.

Requirements

Setup

  1. Create the following files and directory on your host if you don't have them:

    touch ~/.gitconfig ~/.zsh_history
    mkdir -p ~/.ssh
  2. For Docker on OSX: ensure the project directory and your home directory ~ are accessible by Docker.

  3. Open the command palette in Visual Studio Code (CTRL+SHIFT+P).

  4. Select Dev Containers: Open Folder in Container... and choose the project directory.

Customizations

For customizations to take effect, you should "rebuild and reopen":

  1. Open the command palette in Visual Studio Code (CTRL+SHIFT+P)
  2. Select Dev Containers: Rebuild Container

Customizations available are notably:

  • Extend the Docker image in Dockerfile. For example add curl to it:

    FROM qmcgaw/godevcontainer
    RUN apk add curl
  • Changes to VSCode settings and extensions in devcontainer.json.

  • Change the entrypoint script by adding a bind mount in devcontainer.json of a shell script to /root/.welcome.sh to replace the current welcome script. For example:

    // Welcome script
    {
        "source": "./.welcome.sh",
        "target": "/root/.welcome.sh",
        "type": "bind"
    },
  • Change the vscode service container configuration either in docker-compose.yml or in devcontainer.json.

  • Add other services in docker-compose.yml to run together with the development VSCode service container. For example to add a test database:

      database:
        image: postgres
        restart: always
        environment:
          POSTGRES_PASSWORD: password
  • More customizations available are documented in the devcontainer.json reference.