devcontainer with env-setup script

Answered

Hello, our project setup acts as follows:

1. We start a docker container with some basic dependencies installed

docker compose -f docker-compose.yml run --rm --workdir=$PWD dev fish

2. We run some additional setup script in docker to setup the development environment (e.g. setup a venv, install pip packages, set some env variables, install further tools and append them to PATH, …). Let's call this environment “devshell”. So in the docker we run the following command:

source devshell.sh


How can we work with this approach with devcontainers in CLion?

We cannot get devcontainers running properly. so that the CLion terminal and also the CLion plugins are using our devshell environment. 

We tried with some entrypoint in docker like follows:

#!/bin/bash
source "$PROJECT_DIR/devshell.sh"
"$@"

We can see in the devcontainer log, that CLion runs sleep infinity in the correct devshell context. 
But the terminal does not apply the devshell environment, and also the plugins cannot find tools from the devshell.

As workaround, we also tried to source devshell.sh in our .bashrc. With this, the terminal applied correct devshell environment, but the plugins still don't work.

Isn't this a default setup which sould already be working?

Can please someone support here.

0
1 comment

Hello, Thorsten Klein.

Could you please describe the problem you encountered in more detail? For example, which plugins do not work, specific commands and their output that do not behave as expected, etc. 

Also, did you try to set up the environment inside the dev container the same way you do it for a local IDE? For example, for the terminal to work using your custom shell, you'll need to set it up in the `Settings | Tools | Terminal` window just as you did in your local IDE. Dev Containers feature relies on the Remote Development functionality under the hood, and in many cases, the additional time to set up the IDE settings is necessary, as they are not copied to the IDE backend from your local instance.  

0

Please sign in to leave a comment.