Try a Dockerfile like this:
FROM kikitux/oracle6:latest MAINTAINER Alvaro Miranda [email protected] RUN sed -i -e 's/session\s*required\s*pam_loginuid.so$/session optional\ tpam_loginuid.so/' /etc/pam.d/sshd && \ cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ori && \ sed -i -e '/#UseDNS yes/a UseDNS no' /etc/ssh/sshd_config && \ cp /etc/sudoers /etc/sudoers.orig && \ sed -i -e 's/Defaults\\s*requiretty$/#Defaults\trequiretty/' /etc/sudoers && \ sed -i -e '/# %wheel\tALL=(ALL)\tNOPASSWD: ALL/a %wheel\tALL=(ALL)\tNOPASSWD: ALL' /etc/sudoers RUN useradd vagrant && \ mkdir ~vagrant/.ssh && \ chmod 700 ~vagrant/.ssh && \ echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key' | tee -a ~vagrant/.ssh/authorized_keys && \ chmod 600 ~vagrant/.ssh/authorized_keys && \ chown -R vagrant: ~vagrant/.ssh && \ sed -i -e '/# %wheel\tALL=(ALL)\tNOPASSWD: ALL/a vagrant\tALL=(ALL)\tNOPASSWD: ALL' /etc/sudoers That is all you require to enable ssh to work inside a docker and get vagrant user plus ssh key Then you can have EXPOSE 22 CMD /usr/sbin/sshd -D if you want to test test kikitux/oracle6-consul:latest and as command use /usr/sbin/sshd -D On Sun, Oct 12, 2014 at 8:45 PM, Dirk Louwers <[email protected]> wrote: > Hi, > > I have previously already done the try it simulation on their website. To > answer my own question: > > A docker provided box will complain if you don’t send a command to it. > This command can be as simple as “cd .”. Since this command would return > directly Vagrant will think something bad happened to it. To remedy that > you need to set d.remains_running to false. See complete block here: > > config.vm.provider “docker” do |d| > > d.image = “centos:centos6" > d.cmd = ["ls"] > d.remains_running = false > end > > Now you can start provisioning. BUT note that most images do not support > ssh which is a prerequisite for running ansible. There are some images > available that do, like tutum/centos. In order to get this to work you > still have some configuration to do. I will investigate and check back once > I have it running. > > Best, > > Dirk > > On 11 Oct 2014, at 04:21, Alvaro Miranda Aguilera <[email protected]> > wrote: > > Hello > > I will insist on you should do some docker test outside vagrant to see > what docker does, > > https://www.docker.com/tryit/ > > you back? cool, welcome back. > > imagine docker create a vm that does nothing, since that is what docker > is, a 100% isolated enviroment. > > Is more similar to what chroot is, uml (user mode linux), openVz, solaris > containers.. if you have had used any of those, docker is bit ieasier to > get. > > if you havent, then i can tell you that docker is not a virtualmachine. > > Docker will create a OS filesystem, and run 1 or more commands and that is > what that docker container will run > > example, lets say you want to run a web browser, docker require a image to > pull down, and some commands to run and some ports to expose. > > are seral ways to do it, that's why is good to play and make your won way > to doit. > > The ideal way for someone new: > - pull a docker image that does everything! > > this docker image will have already setup some commands to run and some > ports to expose > > but that is not the docker way. > > Docker way goes something like this. > > - define a docker image to pull > - command to run (to setup the image) > - ports to expose > - command to run (to start the image) > > > without those, what you are doing is this: > > - pull a docker image > > done, you have an isolated filesystem and no process running from here. > > from here you can: > > - docker build, that allow you create a new docker image based on a > Dockerfile, that is a set of instructions > - docker run, execute commands on these images (base or new one) > > the images are handled by an ID, but you can tag them for convenience. > > Alvaro > > > On Sat, Oct 11, 2014 at 10:38 AM, Dirk Louwers < > [email protected]> wrote: > >> Hi, >> >> Yes, I have now tried it with centos:centos6. Documentation incorrectly >> mentions centos:6. That still yields that error response. So how would I >> add a command and what command? The vagrant docs don't mention this. I was >> planning to provision the box with ansible. Does anyone know of an example >> of this? >> >> Best, >> >> Dirk >> >> >> >> 2014-10-09 22:42 GMT+02:00 Alvaro Miranda Aguilera <[email protected]>: >> >>> Hello, >>> >>> Docker is a cool new tech, but they do many things in a docker way that >>> is different than a virtual machine. >>> >>> Basically what you are doing in the vagrantfile is download a docker >>> image, but the name is wrong from what I see. plus the message is telling >>> you that you are not doing anything (no commands) >>> >>> index.docker.io have the boxes >>> >>> checking this: >>> >>> https://registry.hub.docker.com/_/centos/tags/manage/ >>> >>> seems the name is like: >>> >>> centos:centos6 >>> >>> and you need to add a command, docker will run a command, imagine a new >>> vm boots out of nothing and 1 command run, there is no boot like a normal >>> OS. >>> >>> so if you run a web server, that will be the only process running inside >>> docker. >>> >>> I would suggest you play a bit with docker outside vagrant first if you >>> haven't done, as that will make things go clear. >>> >>> Alvaro. >>> >>> >>> >>> >>> On Fri, Oct 10, 2014 at 12:34 AM, Dirk Louwers < >>> [email protected]> wrote: >>> >>>> Hi, >>>> >>>> I am new to using Vagrant with Docker and ran into the following issue: >>>> >>>> Given the following block: >>>> >>>> config.vm.provider "docker" do |d| >>>> d.image = "centos:6" >>>> end >>>> >>>> and the following command: >>>> >>>> vagrant up --provider=docker >>>> >>>> I get the following error: >>>> >>>> Error response from daemon: No command specified >>>> >>>> Since the machine is down asking for logs through vagrant docker-logs >>>> crashes so I have no clue how to debug this. >>>> >>>> >>>> Hope someone can shed some light on this. Googling hasn't helped me >>>> much so far. >>>> >>>> >>>> Best, >>>> >>>> >>>> Dirk >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Vagrant" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Vagrant" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/vagrant-up/VqXBSaEXBdU/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Vagrant" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Vagrant" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/vagrant-up/VqXBSaEXBdU/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Vagrant" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
