Giter VIP home page Giter VIP logo

Comments (11)

jordansissel avatar jordansissel commented on May 27, 2024
% kitchen version
Test Kitchen version 1.3.1

from kitchen-docker.

jordansissel avatar jordansissel commented on May 27, 2024

While kitchen converge is waiting, if I do this in another terminal, it recovers and continues quickly:

% docker exec 758a5f693186 /etc/init.d/ssh start
 * Starting OpenBSD Secure Shell server sshd
   ...done.

from kitchen-docker.

jordansissel avatar jordansissel commented on May 27, 2024

I may be a bit lost also. In an effort to try and reproduce this reliably, I destroyed all containers and images (docker rm + rmi). kitchen converge default-ubuntu-1404 now fails differently, and earlier:

% kitchen converge default-ubuntu-1404
-----> Starting Kitchen (v1.3.1)
-----> Converging <default-ubuntu-1404>...
       Preparing files for transfer
       Preparing dna.json
       Berksfile, Cheffile, cookbooks/, or metadata.rb not found so Chef will run with effectively no cookbooks. Is this intended?
       Removing non-cookbook files before transfer
       Preparing solo.rb
       [SSH] connection failed, retrying (#<Errno::ECONNREFUSED: Connection refused - connect(2) for "192.168.59.103" port 49168>)
       [SSH] connection failed, retrying (#<Errno::ECONNREFUSED: Connection refused - connect(2) for "192.168.59.103" port 49168>)
$$$$$$ [SSH] connection failed, terminating (#<Errno::ECONNREFUSED: Connection refused - connect(2) for "192.168.59.103" port 49168>)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [Connection refused - connect(2) for "192.168.59.103" port 49168]

from kitchen-docker.

peterabbott avatar peterabbott commented on May 27, 2024

It is because you are overriding the run command so the sshd deamon is not running.

The driver sets its own run_command:
https://github.com/portertech/kitchen-docker/blob/master/lib/kitchen/driver/docker.rb#L36

You should not really rely on /sbin/init when using Docker containers. If you really do need to start services then consider supervise, but from experience I'd not go down that route.

from kitchen-docker.

jordansissel avatar jordansissel commented on May 27, 2024

You should not really rely on /sbin/init when using Docker containers

Predictably, I expected this response. My particular endeavor requires a real init system to test against. If you need context, see https://github.com/jordansissel/pleaserun.

Any recommendations on having kitchen-docker running init and also starting sshd? Custom Dockerfile per machine? Any prior art in this area?

from kitchen-docker.

peterabbott avatar peterabbott commented on May 27, 2024

One of the key ideas around using Docker is to run single process in their own container and then linking them together (if required). From memory, Docker actually replaces /sbin/init with their own version.

Even when running init, Docker does things behind the scene that means services are not started automatically, you need to each one manually. I went through the pain of discovering that 6 months ago.

One option is to use supervisor which is the recommend approach from the Docker team if you do actually need more than one service running.

The other option would perhaps try the driver https://github.com/marcy-terui/kitchen-docker_cli as it uses docker exec to copy stuff across instead of ssh/scp. Still not sure it will work though, as you would still have to start the services manually.

Looking at the project you have, maybe you have to add support for supervise when running in a Docker container? Or a helper that works out what services to start?

from kitchen-docker.

jordansissel avatar jordansissel commented on May 27, 2024

@peterabbott you are really not understanding what I am asking. "Use supervisord" is a solution to a problem I do not have. I am not asking for a lesson on what you believe Docker to be for.

This kind of "Let me tell you how I use Docker, and therefore your way is wrong" is the same noise I get nearly every time I ask questions near the Docker community.

I'm out.

from kitchen-docker.

peterabbott avatar peterabbott commented on May 27, 2024

Then I guess Docker is the wrong tool for the problem you are trying to solve.

If the Docker team are suggest you to use supervisord then using anything else is probably just going to be waisting your time.

I was in the same spot you were a few months ago, trying to get upstart working. I just didn't work in the way we would expect in other setups. You can't get passed the fact that Docker containers will not automatically start services using upstart/init.d etc.

Running manually like this will work though, but is still a bit annoying to manage:

docker run -it ubuntu:14.04 bash -c "service sshd start && service httpd start && tail -f /var/log/apache2/stdout"

Was just trying to save you the pain of discovering what I went through trying to get init.d/upstart running automatically on Docker.

from kitchen-docker.

aerickson avatar aerickson commented on May 27, 2024

I'm in a situation similar to @jordansissel.

I'm using kitchen-docker because kitchen-vagrant (virtualbox) doesn't work on cloud CI systems, not because I want to use docker. I need to test a setup that uses SysV init. All of my ansible is failing because SSHD isn't running.

It would be nice if there was a way to make this work.

from kitchen-docker.

coderanger avatar coderanger commented on May 27, 2024

@aerickson Unfortunately this is a good example of how Docker is not the same as a tiny VM. It's close, but definitely not the same thing. SysV is functionally dead at this point so most effort is going to making systemd work well for testing, and even that is currently way harder than it should be with kitchen-docker. I would recommend using something like kitchen-ec2 or another cloud driver if you really do need true VMs.

from kitchen-docker.

aerickson avatar aerickson commented on May 27, 2024

Thanks. Realized my setup used Upstart and found this.

http://www.tddfellow.com/blog/2015/08/05/running-kitchen-docker-tests-with-upstart/

from kitchen-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.