Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with docker #13

Closed
epcim opened this issue Apr 28, 2015 · 7 comments
Closed

does not work with docker #13

epcim opened this issue Apr 28, 2015 · 7 comments

Comments

@epcim
Copy link

epcim commented Apr 28, 2015

I have just cloned this repo, changed driver name to docker in .kitchen.yml (... tested only ubuntu suites).

kitchen converge fails on:

             Error executing action `run` on resource 'execute[run hostname]'
             ================================================================================

             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             Expected process to exit with [0], but received '1'
             ---- Begin output of hostname test.kitchen ----
             STDOUT: 
             STDERR: hostname: you must be root to change the host name
             ---- End output of hostname test.kitchen ----
             Ran hostname test.kitchen returned 1

Note use_sudo/sudo: true didn't helped.
I believe previous versions did worked on docker. However I have not yet found what changed...

@flaccid
Copy link
Contributor

flaccid commented Apr 28, 2015

@epcim checkout things found on google such as:

So I guess that means we shouldn't run the hostname command if in a container, so the question is how to check if within a container.

@flaccid
Copy link
Contributor

flaccid commented Apr 28, 2015

@flaccid flaccid self-assigned this Apr 28, 2015
@flaccid
Copy link
Contributor

flaccid commented Apr 28, 2015

chef/ohai#531 was raised. I think we'll need that fixed to ensure support coverage and determine if the same logical check will be used as proposed above.

@epcim
Copy link
Author

epcim commented Apr 28, 2015

Well we may check node.virtualization['system'] for docker/lxc and avoid a change, however since docker 1.2.0 IMHO it's possible to modify even /etc/hosts, /etc/resolv.conf etc.. (moby/moby#5129).

My use-case is functional cookbook testing in docker. I do setup hostname of deployed servers to /etc/hosts (just for convenience). With vagrant/vbox/aws all will work, but the same cookbook used under docker will fail.

I was actually doing the hostname change in the past on docker (chef-boneyard/chef-client#248) however this time there is new issue with the root rights, which I quite don't understand why?

@flaccid
Copy link
Contributor

flaccid commented Apr 28, 2015

It looks like this is more something you are trying to do with Docker. This cookbook was never designed nor supports Docker. Setting hostname in a Docker container seems like a flawed use case.

With that being said we can look at the right graceful degradation once there is an accurate ohai query.

@flaccid
Copy link
Contributor

flaccid commented Aug 10, 2015

Awaiting pull request merge (chef/ohai#569) and then release.

@flaccid
Copy link
Contributor

flaccid commented Oct 18, 2015

I was hoping to do much better but the limitations are all upstream.
Added a .kitchen.docker.yml (7add962). You still can't use hostname set within container, it must be done with docker run -h. Its not practical to support a test suite with increased privilege to the test containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants