Docker mounted on CentOS7.5, pulling CentOS7.5 mirror Docker SSH service and install

 

# Installation docker

yum install -y docker

# Start docker

systemctl start docker

# Join boot

systemctl enable docker

# View status

systemctl status docker

# View docker version

docker --version

# Pull the mirror CentOS7.5

docker pull centos:7.5.1804

 

# View Mirror

docker image ls

# Guardian-type container operation

docker container run -itd --name="centos7.5" 

# View the running state of the container

 

# Into the guard-running vessel

docker container exec -it  /bin/bash

# Use local ftp source of yum

vim /etc/yum.repo/ftp.repo

# Install SSH

yum install -y openssh

# start up

systemctl start ssh

An error

 

After Baidu

Solution

If we use systemctl management services necessary to add parameters to increase --privileged right, and can not use the default bash, replaced by init, the following command

ocker run -d -it --privileged nginx-1 /usr/sbin/init

docker ps -a

docker exec -it 3623 /bin/bash

systemctl start sshd

systemctl status sshd

Guess you like

Origin www.cnblogs.com/opsprobe/p/12078490.html