2

我正在使用 docker-machine 默认 EC2 驱动程序来创建我的 docker 主机: docker-machine start aws-sandbox 它已经启动了。现在尝试将 ansible-container 与默认示例一起使用

version: "2"
  settings:

  conductor:
    base: centos:7
    volumes:
      - /root/.docker/machine/machines/aws-sandbox

  project_name: apache2_example



services: 



web:
    from: "centos:7"
    ports:
      - "80:80"
    command: ["/usr/bin/dumb-init", "/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
registries: {}

构建失败:

# ansible-container build                  
Building Docker Engine context...
Starting Docker build of Ansible Container Conductor image (please be patient)...
Parsing conductor CLI args.
Dockerâ„¢ daemon integration engine loaded. Build starting.     project=apache2_example
Building service...     project=apache2_example service=web
Traceback (most recent call last):
  File "/usr/bin/conductor", line 11, in <module>
    load_entry_point('ansible-container', 'console_scripts', 'conductor')()
  File "/_ansible/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/_ansible/container/cli.py", line 399, in conductor_commandline
    **params)
  File "/_ansible/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/_ansible/container/core.py", line 700, in conductorcmd_build
    cur_image_id = engine.get_image_id_by_tag(service['from'])
  File "/_ansible/container/docker/engine.py", line 549, in get_image_id_by_tag
    image = self.client.images.get(tag)
  File "/_ansible/container/docker/engine.py", line 164, in client
    self._client = docker.from_env(version='auto', timeout=timeout)
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 80, in from_env
    **kwargs_from_env(**kwargs))
  File "/usr/lib/python2.7/site-packages/docker/utils/utils.py", line 450, in kwargs_from_env
    assert_hostname=assert_hostname,
  File "/usr/lib/python2.7/site-packages/docker/tls.py", line 61, in __init__
    'Path to a certificate and key files must be provided'
docker.errors.TLSParameterError: Path to a certificate and key files must be provided through the client_config param. TLS configurations should map the Docker CLI client configurations. See https://docs.docker.com/engine/articles/https/ for API details.
Conductor terminated. Cleaning up.      command_rc=1 conductor_id=060c70af27f716fcb7d4510b1ac0ada354a6c17f18ad38110a80061ca424a9e9 save_container=False

我需要“喂”这些设置吗?

# env | grep -i doc        
DOCKER_HOST=tcp://*****:2376
OLDPWD=/root/Development/ansible-docker
DOCKER_MACHINE_NAME=aws-sandbox
DOCKER_TLS_VERIFY=1
PWD=/root/Development/ansible-docker/apache2_example
DOCKER_CERT_PATH=/root/.docker/machine/machines/aws-sandbox

如何设置 ansible 以在此处正确读取构建阶段的证书?

4

0 回答 0