GithubHelp home page GithubHelp logo

liubasara / dockerfile-from-image Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xiaowei0516/dockerfile-from-image

0.0 1.0 0.0 5 KB

Create a Dockerfile from a Docker image(用于将Docker镜像逆向解析为Dockerfile)

Python 81.70% Dockerfile 18.30%

dockerfile-from-image's Introduction

Dockerfile from image

This project is only at the proof-of-concept state yet

How To

The goal of this project is to easily generate a Dockerfile from an existing Docker image.

To build the image from source (this step is not mandatory as the image also is on the Docker Hub):

git clone https://github.com/lukapeschke/dockerfile-from-image.git
cd dockerfile-from-image
docker build -t lukapeschke/dfa .

To get a Dockerfile from an existing image:

# linux
docker run --rm -v '/var/run/docker.sock:/var/run/docker.sock' lukapeschke/dfa <IMAGE_ID>
# windows
docker run --rm -v '//var/run/docker.sock:/var/run/docker.sock' lukapeschke/dfa <IMAGE_ID>

Example with the official ubuntu image:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED
ubuntu              latest              c73a085dc378        12 days ago

$ docker run  --rm -v '/var/run/docker.sock:/var/run/docker.sock' lukapeschke/dfa c73a085dc378
FROM ubuntu:latest
ADD file:cd937b840fff16e04e1f59d56f4424d08544b0bb8ac30d9804d25e28fb15ded3 in /
RUN /bin/sh -c set -xe 							     \
	&& echo '#!/bin/sh' > /usr/sbin/policy-rc.d 			     \
	&& echo 'exit 101' >> /usr/sbin/policy-rc.d 			     \
	&& chmod +x /usr/sbin/policy-rc.d					\
	&& dpkg-divert --local --rename --add /sbin/initctl 		\
	&& cp -a /usr/sbin/policy-rc.d /sbin/initctl 		\
	&& sed -i 's/^exit.*/exit 0/' /sbin/initctl			\
	&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup			\
	&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean	\
	&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean	\
	&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean 	   			\
	&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages							\
	&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes		\
	&& echo 'Apt::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/docker-autoremove-suggests
RUN /bin/sh -c rm -rf /var/lib/apt/lists/*
RUN /bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
RUN /bin/sh -c mkdir -p /run/systemd \
    && echo 'docker' > /run/systemd/container
CMD ["/bin/bash"]

dockerfile-from-image's People

Contributors

liubasara avatar

Watchers

 avatar

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.