question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:28 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
TylerJewellcommented, Sep 15, 2016

@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.

2reactions
l0rdcommented, Sep 15, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker Networking 101 – Host mode - Das Blinken Lichten
Bridge mode – This is the default, we saw how this worked in the last post with the containers being attached to the...
Read more >
Network problem in bridge mode - VMware Communities
If I configure the guest using Nat mode, it's working fine, I can access to host and to Internet, but I need Bridge...
Read more >
docker containers cannot reach internet in bridge network mode
So basically, the main question is how can I fix the bridge docker0 to be able to reach internet from my containers when...
Read more >
Run X application in a Docker container reliably on a server ...
When not specifying "--net host", the Docker is using the default bridge network mode. This means that "localhost" means something else inside ...
Read more >
docker run - Docker Documentation
Cgroup namespace to use (host|private) 'host': Run the container in the Docker ... Use the cgroup namespace as configured by the default-cgroupns-mode ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found