Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make my own base image for Docker?

Tags:

docker

According to the Docker documentation, to build your own image, you must always specify a base image using the FROM instruction.

Obviously, there are lots of images to choose from in the Docker index, but what if I wanted to build my own? Is that possible?

The image base is built off Ubuntu if I understand correctly, and I want to experiment with a Debian image. Plus, I want to really understand how Docker works, and the base image is still a blackbox for me.


Edit: official documentation on creating a base image

like image 928
Flimm Avatar asked Aug 16 '13 13:08

Flimm


People also ask

What is the base image in Docker?

A base image is the image that is used to create all of your container images. Your base image can be an official Docker image, such as Centos, or you can modify an official Docker image to suit your needs, or you can create your own base image from scratch. Parent topic: Docker.

Does Docker image include base image?

A Docker image has many layers, and each image includes everything needed to configure a container environment -- system libraries, tools, dependencies and other files. Some of the parts of an image include: Base image. The user can build this first layer entirely from scratch with the build command.


2 Answers

You can take a look at how the base images are created and go from there.

You can find them here: https://github.com/dotcloud/docker/tree/master/contrib. There is mkimage-busybox.sh, mkimage-unittest.sh, mkimage-debian.sh

like image 53
creack Avatar answered Nov 15 '22 22:11

creack


Quoting Solomon Hykes:

You can easily create a new container from any tarball with "docker import". For example:

debootstrap raring ./rootfs tar -C ./rootfs -c . | docker import - flimm/mybase 
like image 40
Flimm Avatar answered Nov 15 '22 23:11

Flimm