最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在alpine鏡像中添加ansible服務(wù)的方法

 更新時(shí)間:2018年12月29日 14:45:47   作者:liumiaocn  
今天小編就為大家分享一篇關(guān)于在alpine鏡像中添加ansible服務(wù)的方法,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧

使用apk add ansible即可在alpine鏡像中添加ansible服務(wù)。

添加步驟

在alpine中使用ansible需要如下幾步

Dockerfile

在Dockerfile中添加上面的語句:

#update apk for install
RUN apk update
#install ansible and openssh
RUN apk add ansible openssh
#init ansible hosts file
RUN mkdir -p /etc/ansible
RUN echo "localhost" >/etc/ansible/hosts
#init rsa ssh key pair
RUN ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
#delete cache files 
RUN rm -rf /var/cache/apk/*

使用鏡像

拉取鏡像

大概103M左右

[root@occluster ~]# docker pull liumiaocn/ansible
Using default tag: latest
Trying to pull repository docker.io/liumiaocn/ansible ... 
latest: Pulling from docker.io/liumiaocn/ansible
ff3a5c916c92: Already exists 
42a81541f983: Pull complete 
86602ac17bcb: Pull complete 
73cb14e49a3f: Pull complete 
bdfcad59d746: Pull complete 
455ffeaa5bf1: Pull complete 
dff32643cfa5: Pull complete 
Digest: sha256:46284f3d3b9e3880f9b65fa6b1fb225b19bc88222badf74aa85936aabc24090f
Status: Downloaded newer image for docker.io/liumiaocn/ansible:latest
[root@occluster ~]# 
[root@occluster ~]# docker images |grep ansible
docker.io/liumiaocn/ansible         latest       8a5cfdf8243f    Less than a second ago  103 MB
[root@occluster ~]#

使用

進(jìn)行版本確認(rèn)

[root@occluster ~]# docker run -it --name ansible liumiaocn/ansible sh
/ # ansible --version
ansible 2.4.1.0
 config file = None
 configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
 ansible python module location = /usr/lib/python2.7/site-packages/ansible
 executable location = /usr/bin/ansible
 python version = 2.7.14 (default, Dec 14 2017, 15:51:29) [GCC 6.4.0]
/ #

與宿主機(jī)(192.168.163.172)進(jìn)行溝通,事先設(shè)定ssh通路,可以使用ssh-copy-id

/ # ssh-copy-id 192.168.163.172
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.163.172 (192.168.163.172)' can't be established.
ECDSA key fingerprint is SHA256:uh84Xw56LhiCXb1b0uFbX/CoFhkqHGZjtmLwl3qkTOY.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
expr: warning: '^ERROR: ': using '^' as the first character
of a basic regular expression is not portable; it is ignored
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.163.172's password: 
Number of key(s) added: 1
Now try logging into the machine, with:  "ssh '192.168.163.172'"
and check to make sure that only the key(s) you wanted were added.
/ #

ssh通路確認(rèn)

/ # ssh 192.168.163.172 hostname
occluster
/ #

ansible動(dòng)作確認(rèn)

/ # echo "192.168.163.172" >>/etc/ansible/hosts
/ # ansible 192.168.163.172 -m ping
192.168.163.172 | SUCCESS => {
  "changed": false, 
  "failed": false, 
  "ping": "pong"
}
/ #

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接

相關(guān)文章

  • 解析docker妙用SpringBoot構(gòu)建微服務(wù)實(shí)戰(zhàn)記錄

    解析docker妙用SpringBoot構(gòu)建微服務(wù)實(shí)戰(zhàn)記錄

    Spring Boot 是 Spring 開源組織的子項(xiàng)目,是 Spring 組件一站式解決方案,本文通過詳細(xì)案例給大家解析docker妙用SpringBoot構(gòu)建微服務(wù)實(shí)戰(zhàn)記錄,感興趣的朋友跟隨小編一起看看吧
    2021-11-11
  • Docker多容器連接(以Tomcat+Mysql為例)

    Docker多容器連接(以Tomcat+Mysql為例)

    這篇文章主要介紹了Docker多容器連接(以Tomcat+Mysql為例),Docker提供了多個(gè)容器直接訪問的方法,可以使多個(gè)容器直接通過網(wǎng)絡(luò)端口進(jìn)行訪問
    2017-03-03
  • iptables如何限制宿主機(jī)跟Docker IP和端口訪問(安全整改)

    iptables如何限制宿主機(jī)跟Docker IP和端口訪問(安全整改)

    本文詳細(xì)介紹了如何通過iptables對(duì)網(wǎng)絡(luò)訪問進(jìn)行限制,包括限制特定IP或網(wǎng)段訪問特定服務(wù),以及在Docker環(huán)境下,如何設(shè)置DOCKER-USER鏈限制IP和端口訪問,確保網(wǎng)絡(luò)安全
    2024-10-10
  • 如何在?Docker?中運(yùn)行?Mongodb

    如何在?Docker?中運(yùn)行?Mongodb

    本文詳細(xì)介紹了如何在Docker中安裝并運(yùn)行MongoDB,包括安裝Docker,下載Mongo鏡像,創(chuàng)建容器,連接數(shù)據(jù)庫(kù)和數(shù)據(jù)持久化的方法,通過具體的命令和步驟,使用戶能夠順利在Docker中部署MongoDB服務(wù)
    2024-01-01
  • Docker iptables的錯(cuò)誤解決

    Docker iptables的錯(cuò)誤解決

    本文主要介紹了Docker iptables的錯(cuò)誤解決,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-05-05
  • docker垃圾清理方式

    docker垃圾清理方式

    文章主要介紹了如何刪除Docker鏡像和容器、清理Docker磁盤空間以及配置Docker日志大小,通過這些方法可以有效地管理Docker資源,避免磁盤空間不足的問題
    2025-03-03
  • 在Mac OS X安裝Docker教程

    在Mac OS X安裝Docker教程

    本篇文章主要介紹了在OS X安裝Docker教程,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-02-02
  • 詳解Docker容器數(shù)據(jù)卷

    詳解Docker容器數(shù)據(jù)卷

    這篇文章主要介紹了Docker容器數(shù)據(jù)卷的相關(guān)知識(shí),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-10-10
  • Docker中的容器網(wǎng)絡(luò)和通信原理詳解

    Docker中的容器網(wǎng)絡(luò)和通信原理詳解

    這篇文章主要介紹了Docker中的容器網(wǎng)絡(luò)和通信原理,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2025-04-04
  • 本地Docker安裝Postgres 12 + pgadmin的方法 (支持Apple M1)

    本地Docker安裝Postgres 12 + pgadmin的方法 (支持Apple M1)

    這篇文章主要介紹了本地Docker安裝Postgres 12 + pgadmin的方法 (支持Apple M1),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-03-03

最新評(píng)論

中卫市| 湖州市| 新余市| 崇礼县| 大兴区| 山阳县| 灵台县| 平顺县| 北安市| 永登县| 马龙县| 慈溪市| 黄陵县| 镇江市| 明水县| 长葛市| 谷城县| 霍林郭勒市| 东城区| 罗山县| 乐亭县| 吉木萨尔县| 广丰县| 寿阳县| 南和县| 乃东县| 论坛| 松滋市| 怀柔区| 白朗县| 抚顺市| 江都市| 岚皋县| 绥滨县| 新巴尔虎左旗| 衡南县| 蕉岭县| 监利县| 甘谷县| 宁陵县| 四川省|