docker安装

来源:互联网 发布:数码兽数据库 编辑:程序博客网 时间:2024/05/01 16:00

1.建立稳定的repository:
yum install -y yum-utils

yum-config-manager\
--add-repo\
https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo

2.安装最新版本的docker
yum makecache fast
yum -y install docker-engine

systemctl start docker
docker version

3. pull centos镜像

--使用国内的docker仓库

echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://f2d6cb40.m.daocloud.io\""
service docker restart
docker pull centos


3.2 使用dockerfile导入

docker build -t centos7.1  .  (https://Git.oschina.Net/dockerf/docker-training/tree/master/centos7)

4.进入docker容器

--创建docker容器

docker  run  -d  -p  8022:22  --name springcloud centos7.1:latest      -p指定容器启动后docker上运行的端口映射及容器里运行的端口

进入docker容器

docker exec -it 835ab3ce33d1 /bin/bash





0 0