Use CentOS 6.5 to create a Docker image for Ubuntu 12.04

Source: Internet
Author: User
Tags docker ps

Use CentOS 6.5 to create a Docker image for Ubuntu 12.04

For how to install Docker on CentOS, see:

In the previous article, we created a CentOS image. This time we will create a Ubuntu image on CentOS.

The method is as follows:

Root:

Yum-y install debootstrap

Cd/home/admin/

First execution:

Debootstrap -- arch amd64 precise ubuntu-precise http://mirrors.163.com/ubuntu/

Error: no such script/usr/share/debootstrap/scripts/precise
Solution:
Ln-s/usr/share/debootstrap/scripts/gutsy/usr/share/debootstrap/scripts/precise

Execute again:

Debootstrap -- arch amd64 precise ubuntu-precise http://mirrors.163.com/ubuntu/

Modify permissions:

Chown-R admin. admin ubuntu-precise

Switch to admin user:

Su admin

[Admin @ localhost ~] $ Cd ubuntu-precise/

Create a ubuntu Image

[Admin @ localhost ubuntu-precise] $ tar-c .. | docker import-ubuntu1204-base
Bytes

View the image:

[Admin @ localhost ubuntu-precise] $ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Ubuntu1204-base latest 43ad1b1116dd About a minute ago 172.7 Mbit/s
Centos63-bash latest d2ecedd2b5ed About an hour ago 306.7 Mbit/s

Create an ubuntu container:

[Admin @ localhost ubuntu-precise] $ docker run-t-I ubuntu1204-base/bin/bash
Root @ 8053e2ca797b:/# pwd
/
Root @ 8053e2ca797b:/# exit
Exit

View the current container:

[Admin @ localhost ubuntu-precise] $ docker ps-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8053e2ca797b ubuntu1204-base: latest/bin/bash 31 seconds ago Exited (0) 2 seconds ago thirsty_thompson
14c9afaf2f06 centos63-bash: latest/bin/bash About an hour ago Exited (0) About an hour ago insane_lalande

Restart and enter the ubuntu container:

[Admin @ localhost ubuntu-precise] $ docker start 8053e2ca797b
8053e2ca797b
[Admin @ localhost ubuntu-precise] $ docker attach 8053e2ca797b
Root @ 8053e2ca797b:/# ls
Bin dev home lib64 mnt proc run selinux sys usr
Boot etc lib media opt root sbin srv tmp var

The basic Ubuntu image running in Docker is created successfully.

Install Docker in CentOS 6/7 Series

Detailed explanation of the entire process of building Gitlab CI for Docker

Docker installation application (CentOS 6.5_x64)

What is the difference between Docker and a normal Virtual Machine?

Use MySQL in Docker

Docker will change everything

Docker installation application (CentOS 6.5_x64)

Docker details: click here
Docker: click here

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.