欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在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部署RabbitMQ環(huán)境的詳細(xì)介紹

    用docker部署RabbitMQ環(huán)境的詳細(xì)介紹

    這篇文章主要介紹了用docker部署RabbitMQ環(huán)境,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-07-07
  • 基于Docker的可持續(xù)交付問題

    基于Docker的可持續(xù)交付問題

    這篇文章主要介紹了基于Docker的可持續(xù)交付問題,本文章系列中主要結(jié)合CI持續(xù)集成的工具,把這個(gè)過程完全的自動(dòng)化,以及智能化的過程。當(dāng)然,使用的技術(shù)棧主要是Spring?Boot,具體內(nèi)容詳情跟隨小編一起看看吧
    2022-01-01
  • 用Docker安裝Gitlab的方法步驟

    用Docker安裝Gitlab的方法步驟

    這篇文章主要介紹了用Docker安裝Gitlab的方法步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-08-08
  • 利用docker搭建LAMP運(yùn)行環(huán)境教程詳解

    利用docker搭建LAMP運(yùn)行環(huán)境教程詳解

    LAMP相信對(duì)大家來說都不陌生, Docker是一個(gè)開源的引擎,可以輕松的為任何應(yīng)用創(chuàng)建一個(gè)輕量級(jí)的、可移植的、自給自足的容器,所以這篇文章給大家介紹利用docker快速搭建LAMP運(yùn)行環(huán)境的方法,有需要的朋友們可以參考借鑒,下面來一起看看吧。
    2016-10-10
  • IDEA集成Docker實(shí)現(xiàn)打包的方法

    IDEA集成Docker實(shí)現(xiàn)打包的方法

    本文主要介紹了IDEA集成Docker實(shí)現(xiàn)打包的方法,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-01-01
  • Docker創(chuàng)建運(yùn)行多個(gè)mysql容器的方法示例

    Docker創(chuàng)建運(yùn)行多個(gè)mysql容器的方法示例

    這篇文章主要介紹了Docker創(chuàng)建運(yùn)行多個(gè)mysql容器,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-10-10
  • docker compose安裝es+kibana 8.12.2的詳細(xì)過程

    docker compose安裝es+kibana 8.12.2的詳細(xì)過程

    因云平臺(tái)需要改造,es7升級(jí)為es8,所以記錄一下,es8需要開啟ssl認(rèn)證,需要配置證書,全本帶你用docker安裝,便于后面es8的學(xué)習(xí),這篇文章主要介紹了docker compose安裝es+kibana 8.12.2的詳細(xì)過程,感興趣的朋友跟隨小編一起看看吧
    2024-05-05
  • Docker中的compose簡(jiǎn)介

    Docker中的compose簡(jiǎn)介

    Docker?Compose?是?Docker?官方編排(Orchestration)項(xiàng)目之一,負(fù)責(zé)快速在集群中部署分布式應(yīng)用,這篇文章主要介紹了Docker之compose介紹,需要的朋友可以參考下
    2023-02-02
  • docker部署nexus并啟用https方式

    docker部署nexus并啟用https方式

    這篇文章主要介紹了docker部署nexus并啟用https方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-08-08
  • docker空間爆滿導(dǎo)致的進(jìn)入容器失敗的解決方案

    docker空間爆滿導(dǎo)致的進(jìn)入容器失敗的解決方案

    這篇文章主要介紹了docker空間爆滿導(dǎo)致的進(jìn)入容器失敗的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03

最新評(píng)論