Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make CentOS Image by CentOS6.5 docker

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to make CentOS image by CentOS6.5 docker". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to make CentOS image by CentOS6.5 docker".

To install docker, please see here: http://my.oschina.net/feedao/blog/222306

Installation:

Yum-y install febootstrap

Add a user:

Adduser admin

Add admin users to the docker group:

Usermod-a-G docker admin

Use admin user actions

Su admin

Cd / home/admin

Ordinary users may have various problems when creating an image using a root account:

Febootstrap-I bash-I wget-I yum-I iputils-I iproute centos6 centos6-doc http://mirrors.163.com/centos/6/os/x86_64/

(- I install package, centos6 operating system version, centos6-doc installation directory, and finally source address)

After the success of the above:

Cd centos6-doc/

Tar-c. | docker import-centos63-bash

(centos63-bash is the name of the docker image)

Execute: docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

Centos63-bash latest d2ecedd2b5ed 8 minutes ago 306.7 MB

Test the docker image and create a container:

Docker run-t-I centos63-bash / bin/bash

After quitting

Docker ps-a

[admin@localhost root] $docker ps-a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

14c9afaf2f06 centos63-bash:latest / bin/bash 7 minutes ago Exited (0) 6 minutes ago insane_lalande

Start the container you just created:

Docker start 14c9afaf2f06

Enter the container after startup:

Docker attach 14c9afaf2f06

A simple mirror image is made.

Export and import images make it easy to share image files

Export the mirror:

Docker save IMAGENAME | bzip2-9-c > img.tar.bz2

Import the image (change to another machine):

Bzip2-d-c

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report