Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report