CentOS 6.5 makes Docker images that can be logged by ssh

  • 2020-06-15 10:32:22
  • OfStack

Docker used Series 1 to change the image source to Ali Cloud to facilitate subsequent operations.

To execute this command, change the source address to Ali:


curl https://git.oschina.net/feedao/Docker_shell/raw/start/ali-centos.sh | sh

No. 1 Installation Docker:


yum -y install docker-io

No.2 Start Docker:


service docker start

3. Install tools for making CentOS images:


yum -y install febootstrap

Fourth, make CentOS image file centos6-ES24en directory


febootstrap -i bash -i wget -i yum -i iputils -i iproute -i man -i vim-minimal -i openssh-server -i openssh-clients centos6 centos6-image http://mirrors.aliyun.com/centos/6/os/x86_64/

The fifth one is to make the Docker mirror. The mirror name is centos6-ES33en


cd centos6-image && tar -c .|docker import - centos6-base

The sixth is to make an Docker image that can be logged on by ssh. The name is centos6-ES40en


docker build -t centos6-ssh https://git.oschina.net/feedao/Docker_shell/raw/start/Dockerfile

After the previous 6 steps, a local docker image that can be logged is created.

User name: root, password: 123456

Experience steps:

Create containers:


docker run -d -p 127.0.0.1:33301:22 centos6-ssh

ssh login container:


ssh root@127.0.0.1 -p 33301

Enter your password and you can start fiddling.


Related articles: