ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 392 forks source link

ansible-container not working with images that are not able to run (from: scratch) #897

Open zvonkok opened 6 years ago

zvonkok commented 6 years ago
ISSUE TYPE
container.yml
tar -czf - --files-from /dev/null | docker import - my-scratch
version: "2"
settings:

  conductor:
    base: centos:7
  project_name: itchy

services:
  local:
    from: my-scratch
    roles:
      - itchy

registries: {}
roles/itchy/tasks/main.yml
---
- copy: 
  src: /etc/hosts
  dest: /etc/hosts
OS / ENVIRONMENT
Ansible Container, version 0.9.3rc0
Linux, ip-172-31-24-132.eu-central-1.compute.internal, 3.10.0-858.el7.x86_64, #1 SMP Tue Feb 27 08:59:23 EST 2018, x86_64
2.7.5 (default, Feb  9 2018, 09:51:13) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] /usr/bin/python2
{
  "ContainersPaused": 0, 
  "Labels": null, 
  "DefaultRuntime": "docker-runc", 
  "CgroupDriver": "systemd", 
  "ClusterAdvertise": "", 
  "ContainersRunning": 8, 
  "NGoroutines": 65, 
  "Swarm": {
    "Managers": 0, 
    "ControlAvailable": false, 
    "NodeID": "", 
    "Cluster": {
      "Spec": {
        "Raft": {}, 
        "CAConfig": {}, 
        "Dispatcher": {}, 
        "Orchestration": {}, 
        "TaskDefaults": {}
      }, 
      "Version": {}, 
      "ID": "", 
      "CreatedAt": "0001-01-01T00:00:00Z", 
      "UpdatedAt": "0001-01-01T00:00:00Z"
    }, 
    "Nodes": 0, 
    "Error": "", 
    "RemoteManagers": null, 
    "LocalNodeState": "inactive", 
    "NodeAddr": ""
  }, 
  "LoggingDriver": "json-file", 
  "OSType": "linux", 
  "HttpProxy": "", 
  "Runtimes": {
    "runc": {
      "path": "docker-runc"
    }, 
    "docker-runc": {
      "path": "/usr/libexec/docker/docker-runc-current"
    }
  }, 
  "DriverStatus": [
    [
      "Backing Filesystem", 
      "xfs"
    ], 
    [
      "Native Overlay Diff", 
      "true"
    ]
  ], 
  "OperatingSystem": "Red Hat Enterprise Linux Server 7.4 (Maipo)", 
  "Containers": 69, 
  "HttpsProxy": "", 
  "BridgeNfIp6tables": true, 
  "MemTotal": 128670912512, 
  "Driver": "overlay2", 
  "IndexServerAddress": "https://registry.reg-aws.openshift.com/v1/", 
  "ClusterStore": "", 
  "ExecutionDriver": "", 
  "Registries": [
    {
      "Name": "registry.reg-aws.openshift.com", 
      "Secure": false
    }, 
    {
      "Name": "brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888", 
      "Secure": false
    }, 
    {
      "Name": "registry.access.redhat.com", 
      "Secure": true
    }, 
    {
      "Name": "registry.access.redhat.com", 
      "Secure": true
    }, 
    {
      "Name": "docker.io", 
      "Secure": true
    }
  ], 
  "SystemStatus": null, 
  "OomKillDisable": true, 
  "PkgVersion": "docker-1.12.6-71.git3e8e77d.el7.x86_64", 
  "SystemTime": "2018-03-01T13:32:32.267124777Z", 
  "Name": "ip-172-31-24-132.eu-central-1.compute.internal", 
  "CPUSet": true, 
  "RegistryConfig": {
    "InsecureRegistryCIDRs": [
      "127.0.0.0/8"
    ], 
    "IndexConfigs": {
      "registry.access.redhat.com": {
        "Official": false, 
        "Name": "registry.access.redhat.com", 
        "Secure": true, 
        "Mirrors": []
      }, 
      "registry.reg-aws.openshift.com": {
        "Official": false, 
        "Name": "registry.reg-aws.openshift.com", 
        "Secure": false, 
        "Mirrors": []
      }, 
      "docker.io": {
        "Official": true, 
        "Name": "docker.io", 
        "Secure": true, 
        "Mirrors": null
      }, 
      "brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888": {
        "Official": false, 
        "Name": "brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888", 
        "Secure": false, 
        "Mirrors": []
      }
    }, 
    "Mirrors": null
  }, 
  "SecurityOptions": [
    "seccomp", 
    "selinux"
  ], 
  "ContainersStopped": 61, 
  "NCPU": 16, 
  "NFd": 64, 
  "Architecture": "x86_64", 
  "KernelMemory": true, 
  "CpuCfsQuota": true, 
  "Debug": false, 
  "IndexServerName": "registry.reg-aws.openshift.com", 
  "ID": "ORSW:M4NM:S62A:YYET:OZFD:XMUC:DIV6:DCR6:ZXKA:WBD7:GLQD:XZJO", 
  "IPv4Forwarding": true, 
  "KernelVersion": "3.10.0-858.el7.x86_64", 
  "BridgeNfIptables": true, 
  "NoProxy": "", 
  "LiveRestoreEnabled": false, 
  "ServerVersion": "1.12.6", 
  "CpuCfsPeriod": true, 
  "ExperimentalBuild": false, 
  "MemoryLimit": true, 
  "SwapLimit": true, 
  "Plugins": {
    "Volume": [
      "local"
    ], 
    "Network": [
      "null", 
      "overlay", 
      "bridge", 
      "host"
    ], 
    "Authorization": [
      "rhel-push-plugin"
    ]
  }, 
  "Images": 270, 
  "DockerRootDir": "/var/lib/docker", 
  "NEventsListener": 0, 
  "CPUShares": true
}
{
  "KernelVersion": "3.10.0-858.el7.x86_64", 
  "PkgVersion": "docker-1.12.6-71.git3e8e77d.el7.x86_64", 
  "Os": "linux", 
  "BuildTime": "2017-12-13T12:18:58.588069120-05:00", 
  "ApiVersion": "1.24", 
  "Version": "1.12.6", 
  "GitCommit": "3e8e77d/1.12.6", 
  "Arch": "amd64", 
  "GoVersion": "go1.8.3"
}
SUMMARY

Minimal images that cannot run cannot be used in ansible-container. AFAIK ansible-container tries to do: docker exec -i <container> /bin/sh in this minimal container which will not work since nothing is in there (no /etc/passwd or /bin/sh).

STEPS TO REPRODUCE
atomic-ansible build -- -vvvv
EXPECTED RESULTS

ansible-container copying files into the container.

ACTUAL RESULTS
docker.errors.APIError: 500 Server Error: Internal Server Error ("linux spec user: unable to find user root: no matching entri

http://pastebin.test.redhat.com/560515