Clion connect docker and wsl
Clion
can use remote server, by using target platform environment, Clion can decipher and build delivery. This lesson describer how to consitude such a environment.
Docker
Take docker as an example to illustrate how to setup Clion use remote service as base platform, do compiling / do building / do running.
- Build Ubuntu image
- Settings on Clion
- Sync files
Build Ubuntu image
docker build -t Clion/ubuntu/cpp-env:1.0 -f Dockerfile_cpp-env-ubuntu .
1 | FROM ubuntu:20.04 |
After image has built, use this image in docker-compose.yml as below:
1 | services: |
1 | OTHER_PORT=9006 |
Settings on Clion
Settings on clion refer to Build, Execution, Deployment
- Toolchains
.
Go to Toolchains
, press +
button to add docker
to the list, and fill in Credentials.
Credentials need ports, record on .env
file, and user & password is hard code in the docker image.
Tools as CMake / Make / C Compiler / C++ Compiler / Debugger is also hard code in the docker image, so all this needed tools is already present.
After Clion connect to docker container, connected
prompt will present, like picture as above.
Here is all about settings on Clion to connect remove server.
Sync files
When files is not correct, you can do a sync file action:
wsl - Ubuntu
wsl - Ubuntu is the same as docker. WSL by setting up SSH, download make / cmake / gdb / gcc / c++ tools. Clion do the same as docker stratege to connect to WSL SSH.