Docker

Commands

Submitted by Lizhe on Sat, 04/01/2017 - 16:19

docker pull centos

docker pull daocloud.io/library/centos:latest

docker run --name test -i -t 2785d012ae3e

ctrl p q

 

 

 

Docker network

Submitted by Lizhe on Wed, 05/18/2016 - 15:09

$ docker run -i -t --rm --net=none base /bin/bash

root@63f36fc01b5f:/#

 

# At another shell, learn the container process ID

# and create its namespace entry in /var/run/netns/

# for the "ip netns" command we will be using below

 

$ docker inspect -f '{{.State.Pid}}' 63f36fc01b5f

2778

$ pid=2778

$ sudo mkdir -p /var/run/netns

$ sudo ln -s /proc/$pid/ns/net /var/run/netns/$pid

 

# Check the bridge's IP address and netmask

 

$ ip addr show docker0

21: docker0: ...

centos7 + docker 1.8

Submitted by Lizhe on Fri, 12/11/2015 - 12:14

1.创建docker的yum库

[root@localhost~]# cd /etc/yum.repos.d/

[root@localhostyum.repos.d]# vim docker.repo

[dockerrepo]

name=DockerRepository

baseurl=https://yum.dockerproject.org/repo/main/centos/7

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

(2)安装docker

[root@localhost~]# yum install docker-engine

 

(3)关闭centos7下的firewalld服务并安装iptables-ser

 

[root@localhost~]# systemctl disable firewalld

rm'/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'