is it possible to make a docker image from a debian image

11/8/2016

I am using google compute engine and want to use kubernetes I have created an image for my machine without using dockers. The command I used is

sudo gcimagebundle -d /dev/sda -o /tmp/ --log_file=/tmp/ansible.log 

it results in this image file

6820b8b74dba0d115e3f9e0b969055ac6b67bc65.image.tar.gz

Is is possible to create a Dockerfile that creates a docker image from that image.

Or Do i have to create an empty docker image from debian and install of of my dependencies on it ? because I really prefer not to install all of my dependencies again (it's a day's work)

any solution?

edit : tried this :

>> cat 6820b8b74dba0d115e3f9e0b969055ac6b67bc65.image.tar.gz | docker import - exampleimagelocal:new
Error response from daemon: Error processing tar file(exit status 1): Unhandled tar header type 83
-- WebQube
debian
docker
google-cloud-platform
kubernetes

2 Answers

2/24/2017

You can tar your filesystem, and then

  • you can use ADD in a dockerfile, like it has been said before, or
  • you can docker import the tar

Option 2 in one step would be

tar -c * | docker import - minidebian:raw

If you create a 'raw' image (without metadata) from the tar file, then you can add the docker metadata with a simple dockerfile

FROM minidebian:raw

LABEL description="Minimal Debian 8 image"
MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com>

CMD ["/bin/bash"]

, and building the final image

docker build . -t minidebian:latest

Taken from this guide

https://ownyourbits.com/2017/02/19/creating-a-minimal-debian-container-for-docker/

If you need to create a Debian container, you can follow that guide. It uses debootstrap.

Also, there are already-made containers that you can use

  • The one provided by the guide (small!)

    docker pull ownyourbits/minidebian

  • The official ones from Debian

    docker pull debian:jessie

    docker pull debian:jessie-slim # smaller than jessie

-- nachoparker
Source: StackOverflow

11/8/2016

I dont know gcimagebundle, but if it simply bundels the all files in a tar, without additional metadata this should work

FROM scratch
ADD 6820b8b74dba0d115e3f9e0b969055ac6b67bc65.image.tar.gz /

But it would be better if you would have an Dockerfile, because then it would be easy to make changes to the image and it would be reproducible.

-- Julian
Source: StackOverflow