无法启动由 ansible 创建的 docker 容器

无法启动由 ansible 创建的 docker 容器
**[root@ansiblecontrolnode dockerbuild]# docker images**

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

**[root@ansiblecontrolnode dockerbuild]# docker ps -a**

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

[root@ansiblecontrolnode dockerbuild]# cat build_docker_container.yml
---
        - name: Create a data container
          hosts: localhost
          gather_facts: no
          tasks:
                - name: Downloading "ubuntu" image and spinning up a container from same image
                  docker_container:
                        name: container-created-by-ansible
                        image: ubuntu
                        volumes:
                                - /data
...

**[root@ansiblecontrolnode dockerbuild]# ansible-playbook build_docker_container.yml**

PLAY [Create a data container] ******************************************************************************************************************************************************************

TASK [Downloading "ubuntu" image and spinning up a container from same image] *******************************************************************************************************************
changed: [localhost]

PLAY RECAP **************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0

**[root@ansiblecontrolnode dockerbuild]# docker images**

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

ubuntu              latest              452a96d81c30        5 weeks ago         79.6MB

**[root@ansiblecontrolnode dockerbuild]# docker ps -a**

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES

36161bcee5bc        ubuntu              "/bin/bash"         13 seconds ago      Exited (0) 11 seconds ago                       container-created-by-ansible

**[root@ansiblecontrolnode dockerbuild]# docker start 36161bcee5bc**

36161bcee5bc

**[root@ansiblecontrolnode dockerbuild]# docker attach 36161bcee5bc**

You cannot attach to a stopped container, start it first

**[root@ansiblecontrolnode dockerbuild]# docker ps -a**

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES

36161bcee5bc        ubuntu              "/bin/bash"         35 seconds ago      Exited (0) 11 seconds ago                       container-created-by-ansible

问题——为什么我无法进入这个容器?

相关内容