Docker安装CentOS7

1. 拉取镜像

  docker pull centos:centos7

2. 启动镜像创建容器

  docker run -d -p 36622:22 -p 36680:80 --name centos7-test --privileged=true centos:centos7 /usr/sbin/init

3. 进入容器

  docker exec -it centos7-test /bin/bash

4. 安装 service

  yum -y install initscripts

5. 安装 ifconfig

  yum -y install net-tools.x86_64

6. 安装 ssh

  确认容器已开启 sshd

    rpm -qa | grep ssh

  yun -y install openssh-server

  service sshd restart

7. 查看是否启用 22 端口

  netstat -antp | grep sshd

8. 修改 sshd_config 配置

  vi /etc/ssh/sshd_config

  貌似默认不需要改什么东西

9. 修改密码

  passwd

  输入两次密码

 10. 好了,打开 ssh 工具登录

参考文章:

  https://blog.csdn.net/weipeng19861130/article/details/79006555

  https://blog.csdn.net/Zsigner/article/details/88826423

  https://blog.csdn.net/ynhzdxc/article/details/63693240?utm_source=itdadao&utm_medium=referral

  http://www.elileo.cn/linux/306.html

  https://blog.csdn.net/menghuanbeike/article/details/78958015

  http://ai.baidu.com/forum/topic/show/869940

原文地址:https://www.cnblogs.com/tarencez/p/11856027.html