Closed leowmjw closed 9 years ago
@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]
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
Closing this issue. Feel free to log another issue if you continue have problems.
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
Thanks!