我不擅长英语,Sory。
我是一个Ansible,正在制作一个Docker。
但它无法成功设置 DNS。
错误信息:
TASK [data container] **********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Docker API Error: json: cannot unmarshal string into Go value of type []string"}
我的主.yml
- name: data container
hosts: localhost
vars:
base_image: ubuntu_python
docker_hostname: hoge
tasks:
- name: data container
docker: name={{docker_hostname}} image={{ base_image }} state=started dns=["8.8.8.8"]
我尝试了以下方法,但没有成功。
dns=8.8.8.8
dns="8.8.8.8"
dns=["8.8.8.8"]
感谢您的阅读。
请帮助我
Ansible-playbook main.yml -vvvv
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"cap_add": null, "cap_drop": null, "command": null, "count": 1, "cpu_set": null, "debug": false, "detach": true, "dns": "8.8.8.8",
"docker_api_version": "1.22", "docker_url": null, "docker_user": null, "domainname": null, "email": null, "env": null, "expose": null, "extra_hosts": null, "hostname": null, "image": "ubuntu_python", "insecure_registry": false, "links": null, "log_driver": null, "log_opt": null, "lxc_conf": null,
"memory_limit": 0, "memory_swap": 0, "name": "hoge", "net": null, "password": null, "pid": null, "ports": null, "privileged": false, "publish_all_ports": false, "pull": "missing", "read_only": null, "registry": null, "restart_policy": null, "restart_policy_retry": 0, "signal": null, "state":
"restarted", "stdin_open": false, "stop_timeout": 10, "tls_ca_cert": null, "tls_client_cert": null, "tls_client_key": null, "tls_hostname": null, "tty": false, "use_tls": null, "username": null, "volumes": null, "volumes_from": null}, "module_name": "docker"}, "msg": "Docker API Error: json: cannot unmarshal string into Go value of type []string"}
尝试:
name: data container
docker:
name: {{docker_hostname}}
image: {{base_image}}
state: restarted
dns: ["8.8.8.8"]
-
名称:创建 PostgresSql 容器docker_container:名称: PostgreSQL图片:PostgreSQL:最新dns_servers:
- 172.10.0.1卷: /etc/
- localtime:/etc/localtime /data/
- postgres:/var/lib/postgresql/data港口: "5432
- :5432"网络:
- 名称:终极游戏环境:TZ : "亚洲/加尔各答">
标签: [总是, 第三方]