che: Problem using Bridge Mode for Server and Workspace Containers (can't use --net=host)

I’m running codenvy/che-server image with docker in a host machine which I’m not able to change the /etc/resolv.conf file. So, in order to allow containers to connect to internet I have to use bridge network mode which I do with the following command:

VOLUMES="-v /var/run/docker.sock:/var/run/docker.sock -v /home/user/che/lib:/home/user/che/lib-copy -v /home/user/che/workspaces:/home/user/che/workspaces -v /home/user/che/storage:/home/user/che/storage"

docker run --name che $VOLUMES -P --dns my_dns1 --dns my_dns2 --env  http_proxy=myproxy:8080 codenvy/che-server --remote:REMOTE_IP

Up to that point I cat ssh into the server container and wget / clone any internet url. However, when I create a new workspace I always get a message saying “Internal Server Error: https://github.com/che-samples/blank: cannot open git-upload-pack” (actually not so meaningful).

Then I ssh into the newly created workspace containter and try to wget / clone any webpage/repo from internet with no luck.

If I do “cat /etc/resolv.conf” in both server and workspace containers, I can see that only the server has the correct DNS configutarion. This may be logic but problematic as the --net=host option is not really an option in my case.

Is there any way I can instruct che-server to use bridge mode for workspace containers as well? Also, to pass other variables like DNS or Proxy.

Reproduction Steps:

  1. Configure host DNS so you can’t resolv google, or github or repo.maven.apache.org launch codenvy/che-server with default bridge mode adding dns and proxy parameters in run command
  2. Go to http://REMOTE_IP:8080/ (or your assigned port) and create a new workspace with default balnk project

Expected behavior:

Server and workspace containers should share their network configuration or at least provide a way to configure docker run arguments in the che.properties.

Observed behavior:

The server will launch correctly whereas the workspace container won’t be able to clone the template project from github. As the workspace container will be still launched with --net=host parameter, it won’t have the proper DNS or Proxy configuration.

image

OS and version: RHEL 7 Docker version: 1.8.0,

Additional information:

  • Problem started happening recently, didn’t happen in an older version of Che: NO
  • Problem can be reliably reproduced, doesn’t happen randomly: YES

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 28 (6 by maintainers)

Most upvoted comments

@raphsoft - if it was “latest” from 4 days ago it is 4.7.2. I have added an issue to add an improvement to the Che CLI so that if you are running a che-server, it will connect to it to discover the version of that server.

We should always avoid --net=host. Bridge mode is more flexible. In the long term we should consider creating a custom che network. I think that @garagatyi was already considering that solution and I would be happy to help on this topic.