使用docker-machine的ansible-container构建在证书问题上失败

时间:2018-02-22 08:45:10

标签: python docker-machine ansible-container

我正在使用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

我是否需要“提供”Ansible这些设置?

# 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以正确读取构建阶段的证书?

0 个答案:

没有答案