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

"Cannot start container " when trying to reverse engineer Dockerfile #2

Closed
leowmjw opened this issue Jan 25, 2015 · 3 comments
Closed

Comments

@leowmjw
Copy link

leowmjw commented Jan 25, 2015

The reverse engineering of Dockerfile from Docker image seems to fail inconsistently. The test case used is "dockerfile-from-image" itself. Seems to be somehow related to failure in unmounting image.

Details below .. Any clues?

ubuntu@ip-10-0-0-168:~$ docker --version
Docker version 1.4.1, build 5bc2ff8

ubuntu@ip-10-0-0-168:~$ sudo docker images
REPOSITORY                          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centurylink/dockerfile-from-image   latest              00c8dfdef4c3        5 months ago        340.2 MB
...
...

ubuntu@ip-10-0-0-168:~$ sudo docker run -v /var/run/docker.sock:/var/run/docker.sock   centurylink/dockerfile-from-image centurylink/dockerfile-from-image
FATA[0000] Error response from daemon: Cannot start container babcf5872ed314d119f5bd12036d0793960ba83a1faa3ea36f8487e265ae8eec: mkdir /sys/fs/cpuset: no such file or directory 

ubuntu@ip-10-0-0-168:~$ sudo docker run -v /var/run/docker.sock:/var/run/docker.sock   centurylink/dockerfile-from-image centurylink/dockerfile-from-imageFATA[0000] Error response from daemon: Cannot start container c6e0aebf3a986215b5199d3b5cba52ac8978671f6873b60f00289abec8d9e7bf: mkdir /sys/fs/cpu: no such file or directory 

Thanks!

@bdehamer
Copy link
Collaborator

@leowmjw based on the mkdir /sys/fs/cpu: no such file or directory error message, I'm guessing it might be an issue with your Docker installation.

I ran this a bunch of times just now against various images (including the "dockerfile-from-image" image itself) and was unable to make it fail:

$ docker run -v /var/run/docker.sock:/var/run/docker.sock centurylink/dockerfile-from-image centurylink/dockerfile-from-image
FROM scratch:latest
ADD file:51f55dad71612120f31d0adf486db5717ed0ff07e3f1f62bd5922ba6a9d6ec07 in /
CMD [/bin/bash]
MAINTAINER CenturyLink Labs <clt-labs-futuretech@centurylink.com>
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libreadline6-dev zlib1g-dev libssl-dev libffi-dev libyaml-dev libgdbm-dev wget
RUN wget -nv http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz && tar xfz ruby-2.1.2.tar.gz && cd ruby-2.1.2 && ./configure --disable-install-doc && make && make install && cd .. && rm -r ruby-2.1.2 ruby-2.1.2.tar.gz
RUN echo 'gem: --no-document' >> /.gemrc
RUN wget -nv http://production.cf.rubygems.org/rubygems/rubygems-2.3.0.tgz && tar xfz rubygems-2.3.0.tgz && cd rubygems-2.3.0 && ruby setup.rb && cd .. && rm -r rubygems-2.3.0 rubygems-2.3.0.tgz
RUN gem install --no-document bundler
RUN gem install docker-api
ADD file:e562309325c1c148058e5e0dd495b7dcbf449e18aca856571e8aa1ef9b0b9f99 in /usr/src/app/dockerfile-from-image.rb
WORKDIR /usr/src/app
RUN chmod +x dockerfile-from-image.rb
CMD [--help]
ENTRYPOINT [/usr/src/app/dockerfile-from-image.rb]

@ozbillwang
Copy link
Contributor

looks good for me. I got the right Dockerfile.

core@core-01 ~/dockerfile-from-image $ docker pull centurylink/dockerfile-from-image
core@core-01 ~/dockerfile-from-image $ docker run -v /var/run/docker.sock:/var/run/docker.sock centurylink/dockerfile-from-image centurylink/dockerfile-from-image
FROM alpine:3.1
MAINTAINER CenturyLink Labs <clt-labs-futuretech@centurylink.com>
ENTRYPOINT ["/usr/src/app/dockerfile-from-image.rb"]
CMD ["--help"]
RUN apk update && apk add ruby-dev ca-certificates
RUN gem install --no-rdoc --no-ri docker-api
ADD file:ca2f6672120c2fb4595ac2b160d8325066cb2b40f64405171b15bff98be02f88 in /usr/src/app/dockerfile-from-image.rb

This is really cool, set an alias on it to make it as a simple command.

The -f option is so useful, I am looking for a similar function and get it here.

core@core-01 ~/dockerfile-from-image $ alias dimages="docker run -v /var/run/docker.sock:/var/run/docker.sock -rm dockerfile-from-image"
core@core-01 ~/dockerfile-from-image $ dimages -h
Usage: dockerfile-from-image.rb [options] <image_id>
    -f, --full-tree                  Generate Dockerfile for all parent layers
    -h, --help                       Show this message
core@core-01 ~/dockerfile-from-image $ dimages ruby
core@core-01 ~/dockerfile-from-image $ dimages -f ruby

@bdehamer
Copy link
Collaborator

bdehamer commented Aug 2, 2015

Closing this issue. Feel free to log another issue if you continue have problems.

@bdehamer bdehamer closed this as completed Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants