實際操作測試2 - Docker容器部署

以下是小編在看Udemy前的實作測試

Pull an image

# Install ansible
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
# Install pip and docker-py
sudo apt-get install python-pip python-dev build-essential 
sudo pip install --upgrade pip
sudo pip install docker-py

Edit the playbook

- hosts: localhost
  become: true # use root user with sudo
  tasks:
  - name : Pull Ubuntu Image
    docker_image:
      name: ubuntu

Run ansible-book docker_pull.yml

Last updated

Was this helpful?