CentOS · CentOS 6 · Docker · Docker Images · Linux Distribution

Building official CentOS 6 image for Docker

For building the official CentOS docker image, we would need to download the necessary files from the following link:

CentOS 6 Official docker image build files

The following are the necessary files

  1. File named  dockerfile
  2. The compressed CentOS6 docker file

Create a directory for downloading the files.

mkdir CentOS-Docker
cd CentOS-Docker
Now download the files into this directory. The files can be downloaded using the following commands
wget https://github.com/CentOS/sig-cloud-instance-images/raw/311d80f2e558eba3a6ea88c387714ae2e4175702/docker/Dockerfile
wget https://github.com/CentOS/sig-cloud-instance-images/blob/311d80f2e558eba3a6ea88c387714ae2e4175702/docker/centos-6-20150615_2019-docker.tar.xz?raw=true
mv centos-6-20150615_2019-docker.tar.xz\?raw\=true centos-6-20150615_2019-docker.tar.xz

Once these files are downloaded, run the following command to build the docker image

docker build .

The output of the command will be like this.

Sending build context to Docker daemon 98.86 MB
Sending build context to Docker daemon 
Step 0 : FROM scratch
Step 1 : MAINTAINER The CentOS Project  - ami_creator
 ---> Using cache
 ---> f1b10cd84249
Step 2 : ADD centos-6-20150615_2019-docker.tar.xz /
 ---> c1f42ce4ff39
Removing intermediate container 2a4b49b94ee1
Step 3 : CMD /bin/bash
 ---> Running in 7b76234dc0e4
 ---> 9891dba63992
Removing intermediate container 7b76234dc0e4
Successfully built 9891dba63992

Now run the container from this image built, by using the following command

docker run docker -it 9891dba63992 /bin/bash

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s