Get the App
SLTechnology News&Howtos  ›  Servers  › 

The process of making automatic Credit Docker Container Image under CentOS6.5

Shulou Source: shulou.com Published: 2022-06-01 10:20:09 10月22日 Update

This article mainly introduces "the process of making automatic credit Docker container image under CentOS6.5". In daily operation, I believe many people have doubts about the process of making automatic credit Docker container image under CentOS6.5. I have consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "the process of making automatic credit Docker container image under CentOS6.5"! Next, please follow the small series to learn together!

Centos6-base and centos6-ssh, today we rely on centos6-ssh mirror to make a third auto-credited mirror centos-newssh.

The method is as follows:

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

One command will do, and this command will create a new mirror centos-newssh

To get started, there is no need to enter the root password:

docker run -d -p 127.0.0.1:33306:22 -m 256M centos-newsshssh root@127.0.0.1 -p 33306 "echo $LANG;ifconfig"

If you do not want to type yes the first time you connect, you can confirm the connection by using the following command:

ssh -o StrictHostKeyChecking=no root@127.0.0.1 -p 33306 "echo $LANG;ifconfig"

After the experience, let's analyze it

https://git.oschina.net/feedao/Docker_shell/raw/start/Docker-centos-autossh.sh#!/ bin/sh[ ! -d /root/.ssh ] && mkdir -p /root/.sshssh-keygen -q -N "" -t dsa -f /root/.ssh/id_dsaKEY_PUB=`cat /root/.ssh/id_dsa.pub`[ ! -d /root/docker-temp ] && mkdir /root/docker-tempcd /root/docker-tempcat >/root/docker-temp/Dockerfile >Dockerfilecd /root && cat /root/docker-temp/Dockerfile | docker build -t centos-newssh -

Script content is relatively simple, is to generate a new secret key and public key

ssh-keygen -q -N "" -t dsa -f /root/.ssh/id_dsa

Then automatically add the public key to Docker container, here is to modify Dockerfile:

echo "RUN echo \"$KEY_PUB\" > /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys " >>Dockerfile

Finally, create a new mirror:

cd /root && cat /root/docker-temp/Dockerfile | docker build -t centos-newssh -

You can delete the/root/docker-temp folder

rm -rf /root/docker-temp

At this point, the study of "the process of making automatic credit Docker container image under CentOS6.5" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Tags: Mirror container production process learning command public key method more experience help input utility next three creative content finished password that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia MySQL Docker Shulou Tech Info