building a centos docker base image
来源:互联网 发布:php soapheader详解 编辑:程序博客网 时间:2024/06/09 13:23
http://failshell.io/docker/building-a-centos-docker-base-image/
There’s been a lot of buzz lately around the Go programming language. A lot of cool tools have been written using it. One in particular, which has a lot of buzz too: Docker. Like many others, I’m really interested in Docker, because it has the potential to help me resolve a recurring issue: facilitating software deployments as much as possible.
Most deployments issues have been solved, for me at least, by using a CM tool like Chef. Problem is, sometimes, you need to roll back a deployment, and even if you use a CM, that’s gonna be tricky.
With Docker, you simply have to replace a contrainer, and you are good to go.
So as I explore that new technology, I plan on posting my findings and experience with it here.
In this first installment, I will explore building a RHEL/Centos Docker base image.
What is Docker?
Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.
Requirements
- a RHEL/CentOS VM
- a kernel supporting AUFS
- Docker
- febootstrap (available in the EPEL repository)
- IP Forwarding enabled (otherwise, networking in containers won’t work)
Getting our environment ready
I’ve written a Chef cookbook (use >= 0.1.6) that takes care of setting up a Docker-ready server. I recommend using that to get up and running quickly. Otherwise, make sure you meet the above requirements before moving on.
Building the image
We’ll be using febootstrap to create a RHEL/CentOS image in a fakeroot. It mimics the behavior of debootstrap. Very useful to create images for LXC/OpenVZ.
[root@banshee ~]# febootstrap -i iputils -i vim-minimal -i iproute -i bash -i coreutils -i yum centos centos http://centos.mirror.iweb.ca/6.4/os/x86_64/ -u http://centos.mirror.iweb.ca/6.4/updates/x86_64/febootstrap | 3.7 kB 00:00febootstrap/primary_db | 4.4 MB 00:03febootstrap-updates | 3.4 kB 00:00febootstrap-updates/primary_db | 4.4 MB 00:02Setting up Install ProcessResolving Dependencies[snip]
NOTE
: Make sure you run febootstrap
as root. Otherwise, you gonna walk into a world of pain with permissions in your container.
Now that we have our image in our fakeroot, we need to import it into Docker.
[root@banshee ~]# cd centos/[root@banshee centos]# tar -c . | docker import - centos5df8a8c8477a
Our newly created image is now available and ready for use.
[root@banshee centos]# docker imagesREPOSITORY TAG ID CREATED SIZEcentos latest 5df8a8c8477a 38 seconds ago 316.8 MB (virtual 316.8 MB)
Testing our new image
Let’s see if it works.
[root@banshee centos]# docker run centos /bin/ping google.com -c 1PING google.com (24.200.237.123) 56(84) bytes of data.64 bytes from 24.200.237.123: icmp_seq=1 ttl=60 time=10.7 ms--- google.com ping statistics ---1 packets transmitted, 1 received, 0% packet loss, time 13msrtt min/avg/max/mdev = 10.742/10.742/10.742/0.000 ms
[root@banshee centos]# docker run -t -i centos /bin/bashbash-4.1# uname -r3.10.5-3.el6.x86_64bash-4.1# hostnamed393248f8119
That’s it.
In the next installment, I will explain how to customize our new base image to run a website using Nginx.
- building a centos docker base image
- 制作centos base image for docker
- 自已创建Docker Base Image
- Create a Base Image
- Create a base image
- Building a Standard Vista Image
- Docker Serials 1: 安装Docker 和 编译Base Image
- Building a Master Image - Part 1: VMware
- Docker base
- Building A Master Image - Part 2: Preparing Windows XP
- 二、Building a Run-Time Image for the Emulator
- use docker to setup building environment for a project
- CENTOS: Docker Pull下来的TOMCAT Image安装东西。
- docker host OS 和 the container base image OS 之间的关系
- docker-image
- docker image
- Image$$RO$$Base
- |Image$$RO$$Base|解析
- 频繁分配释放内存导致的性能问题的分析
- 佛敎의 敎理
- VC定义的三种类型DLL有什么区别
- linux创建新进程的过程
- ubuntu----VMware 鼠标自由切换问题及主机虚拟机共享剪切板问题
- building a centos docker base image
- 儒敎의 敎理
- 英雄会-回文数
- 8086汇编的一些知识点的备忘
- 特征码免杀
- Servlet
- MFC DLL静态链接
- hadoop学习.分布式计算开源框架Hadoop介绍
- SGU110 计算几何 Computational Geometry