Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

build command works different when --debug flag is set #937

Open
zskulcsar opened this issue Jun 5, 2018 · 1 comment
Open

build command works different when --debug flag is set #937

zskulcsar opened this issue Jun 5, 2018 · 1 comment
Labels
bug pr-pending There is un-approved PR for that ticket

Comments

@zskulcsar
Copy link

ISSUE TYPE
  • Bug Report
container.yml
version: "2"
settings:
  project_name: petrol_nginx
  conductor:
    conductor_base: centos:7
    save: yes

services:
  web:
    from: centos:7
    roles:
      - nginx
    ports:
      - 80:80
      - 443:443
    command: [nginx, -g, daemon off;]
OS / ENVIRONMENT
Ansible Container, version 0.9.2
Darwin, zsolts.lan, 15.6.0, Darwin Kernel Version 15.6.0: Wed May  2 21:04:22 PDT 2018; root:xnu-3248.73.10~1/RELEASE_X86_64, x86_64
2.7.15 (default, May 15 2018, 08:02:01)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] /Users/zsoltk/work/iw/petrol-test/venv/bin/python
{
  "ContainersPaused": 0,
  "Labels": [],
  "CgroupDriver": "cgroupfs",
  "ContainersRunning": 0,
  "ContainerdCommit": {
    "Expected": "773c489c9c1b21a6d78b5c538cd395416ec50f88",
    "ID": "773c489c9c1b21a6d78b5c538cd395416ec50f88"
  },
  "InitBinary": "docker-init",
  "NGoroutines": 41,
  "Swarm": {
    "ControlAvailable": false,
    "NodeID": "",
    "Error": "",
    "RemoteManagers": null,
    "LocalNodeState": "inactive",
    "NodeAddr": ""
  },
  "LoggingDriver": "json-file",
  "OSType": "linux",
  "HttpProxy": "docker.for.mac.http.internal:3128",
  "Runtimes": {
    "runc": {
      "path": "docker-runc"
    }
  },
  "DriverStatus": [
    [
      "Root Dir",
      "/var/lib/docker/aufs"
    ],
    [
      "Backing Filesystem",
      "extfs"
    ],
    [
      "Dirs",
      "187"
    ],
    [
      "Dirperm1 Supported",
      "true"
    ]
  ],
  "OperatingSystem": "Docker for Mac",
  "Containers": 26,
  "HttpsProxy": "docker.for.mac.http.internal:3129",
  "BridgeNfIp6tables": true,
  "MemTotal": 2096066560,
  "SecurityOptions": [
    "name=seccomp,profile=default"
  ],
  "Driver": "aufs",
  "IndexServerAddress": "https://index.docker.io/v1/",
  "ClusterStore": "",
  "InitCommit": {
    "Expected": "949e6fa",
    "ID": "949e6fa"
  },
  "GenericResources": null,
  "Isolation": "",
  "SystemStatus": null,
  "OomKillDisable": true,
  "ClusterAdvertise": "",
  "SystemTime": "2018-06-05T12:35:22.9594018Z",
  "Name": "linuxkit-025000000001",
  "CPUSet": true,
  "RegistryConfig": {
    "AllowNondistributableArtifactsCIDRs": [],
    "Mirrors": [],
    "IndexConfigs": {
      "docker.io": {
        "Official": true,
        "Name": "docker.io",
        "Secure": true,
        "Mirrors": []
      }
    },
    "AllowNondistributableArtifactsHostnames": [],
    "InsecureRegistryCIDRs": [
      "127.0.0.0/8"
    ]
  },
  "DefaultRuntime": "runc",
  "ContainersStopped": 26,
  "NCPU": 2,
  "NFd": 22,
  "Architecture": "x86_64",
  "KernelMemory": true,
  "CpuCfsQuota": true,
  "Debug": true,
  "ID": "HSGA:HLJS:2ITV:VU2S:VTWN:7TCI:GWSW:GYRC:6RXV:VXWX:NOHC:HIRP",
  "IPv4Forwarding": true,
  "KernelVersion": "4.9.87-linuxkit-aufs",
  "BridgeNfIptables": true,
  "NoProxy": "",
  "LiveRestoreEnabled": false,
  "ServerVersion": "18.03.1-ce",
  "CpuCfsPeriod": true,
  "ExperimentalBuild": true,
  "MemoryLimit": true,
  "SwapLimit": true,
  "Plugins": {
    "Volume": [
      "local"
    ],
    "Network": [
      "bridge",
      "host",
      "ipvlan",
      "macvlan",
      "null",
      "overlay"
    ],
    "Authorization": null,
    "Log": [
      "awslogs",
      "fluentd",
      "gcplogs",
      "gelf",
      "journald",
      "json-file",
      "logentries",
      "splunk",
      "syslog"
    ]
  },
  "Images": 89,
  "DockerRootDir": "/var/lib/docker",
  "NEventsListener": 2,
  "CPUShares": true,
  "RuncCommit": {
    "Expected": "4fc53a81fb7c994640722ac585fa9ca548971871",
    "ID": "4fc53a81fb7c994640722ac585fa9ca548971871"
  }
}
{
  "KernelVersion": "4.9.87-linuxkit-aufs",
  "Components": [
    {
      "Version": "18.03.1-ce",
      "Name": "Engine",
      "Details": {
        "KernelVersion": "4.9.87-linuxkit-aufs",
        "Os": "linux",
        "BuildTime": "2018-04-26T07:22:38.000000000+00:00",
        "ApiVersion": "1.37",
        "MinAPIVersion": "1.12",
        "GitCommit": "9ee9f40",
        "Arch": "amd64",
        "Experimental": "true",
        "GoVersion": "go1.9.5"
      }
    }
  ],
  "Arch": "amd64",
  "BuildTime": "2018-04-26T07:22:38.000000000+00:00",
  "ApiVersion": "1.37",
  "Platform": {
    "Name": ""
  },
  "Version": "18.03.1-ce",
  "MinAPIVersion": "1.12",
  "GitCommit": "9ee9f40",
  "Os": "linux",
  "Experimental": true,
  "GoVersion": "go1.9.5"
}
SUMMARY

When running ansible-container build command the command fails with an exception. When running with --debug flag set, it executes without problem.

STEPS TO REPRODUCE
ansible-container build
ansible-container --debug build
EXPECTED RESULTS

code behaves the same irrespective to the --debug flag.

ACTUAL RESULTS
ansible-container build
Building Docker Engine context...
Starting Docker build of Ansible Container Conductor image (please be patient)...
ERROR	Unknown exception
Traceback (most recent call last):
  File "/Users/zsoltk/work/iw/petrol-test/venv/lib/python2.7/site-packages/container/cli.py", line 299, in __call__
    getattr(core, u'hostcmd_{}'.format(args.subcommand))(**vars(args))
  File "/Users/zsoltk/work/iw/petrol-test/venv/lib/python2.7/site-packages/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/Users/zsoltk/work/iw/petrol-test/venv/lib/python2.7/site-packages/container/core.py", line 181, in hostcmd_build
    environment=env_vars
  File "/Users/zsoltk/work/iw/petrol-test/venv/lib/python2.7/site-packages/container/docker/engine.py", line 105, in __wrapped__
    return fn(self, *args, **kwargs)
  File "/Users/zsoltk/work/iw/petrol-test/venv/lib/python2.7/site-packages/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/Users/zsoltk/work/iw/petrol-test/venv/lib/python2.7/site-packages/container/docker/engine.py", line 1070, in build_conductor_image
    return image.id
AttributeError: 'tuple' object has no attribute 'id'
@Voronenko
Copy link
Contributor

Workaround would be using virtual environment and full sized requirements.txt to freeze the dependencies, like

ansible-container==0.9.2
backports.ssl-match-hostname==3.5.0.1
certifi==2018.1.18
chardet==3.0.4
colorama==0.3.9
docker==3.1.1
docker-pycreds==0.2.2
idna==2.6
ipaddress==1.0.19
Jinja2==2.10
MarkupSafe==1.0
PyYAML==3.12
requests==2.18.4
ruamel.ordereddict==0.4.13
ruamel.yaml==0.15.35
six==1.11.0
structlog==18.1.0
urllib3==1.22
websocket-client==0.47.0

And here is Makefile POC to accomplish virtualenv based build

https://github.com/softasap/sa-container-bootstrap/blob/master/box-example/alpine-36/Makefile

@Voronenko Voronenko added the bug label Jun 19, 2018
@Voronenko Voronenko added the pr-pending There is un-approved PR for that ticket label Jul 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug pr-pending There is un-approved PR for that ticket
Projects
None yet
Development

No branches or pull requests

2 participants