saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

dockerng.sls_build not working #39764

Closed sdemura closed 6 years ago

sdemura commented 7 years ago

Description of Issue/Question

dockerng.build_sls does not work.

Setup

Following instructions here: https://docs.saltstack.com/en/latest/topics/tutorials/docker_sls.html

Steps to Reproduce Issue

Follow instructions here: https://docs.saltstack.com/en/latest/topics/tutorials/docker_sls.html

Tested on Trusty, Xenial and CentOS 7. Result is the same.

Result:

root@ubuntu-01:~# salt-call --local dockerng.sls_build "test" -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Trying paths: ['/home/apcera/.docker/config.json', '/home/apcera/.dockercfg']
[DEBUG   ] No config file found
[DEBUG   ] "GET /version HTTP/1.1" 200 221
[DEBUG   ] "GET /v1.26/version HTTP/1.1" 200 221
[DEBUG   ] LazyLoaded dockerng.sls_build
[DEBUG   ] "GET /v1.26/images/opensuse/python/json HTTP/1.1" 200 1669
[DEBUG   ] "GET /v1.26/version HTTP/1.1" 200 221
[DEBUG   ] dockerng.create is using the following kwargs to create container 'test' from image 'opensuse/python': {'host_config': {'NetworkMode': 'default'}, 'tty': True, 'stdin_open': True, 'command': 'sleep infinity'}
[DEBUG   ] "POST /v1.26/containers/create?name=test HTTP/1.1" 201 90
[DEBUG   ] LazyLoaded mine.send
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] LazyLoaded network.interfaces
[DEBUG   ] LazyLoaded data.get
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "POST /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/start HTTP/1.1" 204 0
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/info HTTP/1.1" 200 None
[DEBUG   ] LazyLoaded container_resource.run
[DEBUG   ] LazyLoaded cmd.run_all
[INFO    ] Executing command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f -- mkdir -p /tmp/salt.dockerng.9e4851' in directory '/home/apcera'
[ERROR   ] Command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f -- mkdir -p /tmp/salt.dockerng.9e4851' failed with return code: 1
[ERROR   ] stderr: Error: container 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f is not defined
[ERROR   ] retcode: 1
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] compile template:
[ERROR   ] Template does not exist:
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG   ] Updating roots fileserver cache
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[INFO    ] Executing command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f -- mkdir -p /tmp/salt.dockerng.cfedfe' in directory '/home/apcera'
[ERROR   ] Command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f -- mkdir -p /tmp/salt.dockerng.cfedfe' failed with return code: 1
[ERROR   ] stderr: Error: container 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f is not defined
[ERROR   ] retcode: 1
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "POST /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/stop?t=10 HTTP/1.1" 204 0
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 197, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 5909, in sls_build
    raise CommandExecutionError(ret)
CommandExecutionError: {'comment': 'Error: container 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f is not defined', 'result': False}
Error running 'dockerng.sls_build': {'comment': 'Error: container 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f is not defined', 'result': False}

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
           Salt: 2016.11.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
        machine: x86_64
        release: 4.4.0-34-generic
         system: Linux
        version: Ubuntu 16.04 xenial

root@ubuntu-01:~# docker --version
Docker version 1.13.1, build 092cba3
gtmanfred commented 7 years ago

if you add

base:
  '*':
    - test

To the top.sls file at /srv/salt/top.sls, or reference - vim if you are following the documentation directly does it work?

Thanks, Daniel

sdemura commented 7 years ago
root@salt-master:/srv/salt# cat vim.sls
vim:
  pkg.installed

Re-run, this time with mods=vim

root@ubuntu-01:~# salt-call --local dockerng.sls_build "test" mods=vim -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Trying paths: ['/home/apcera/.docker/config.json', '/home/apcera/.dockercfg']
[DEBUG   ] No config file found
[DEBUG   ] "GET /version HTTP/1.1" 200 221
[DEBUG   ] "GET /v1.26/version HTTP/1.1" 200 221
[DEBUG   ] LazyLoaded dockerng.sls_build
[DEBUG   ] "GET /v1.26/images/opensuse/python/json HTTP/1.1" 200 1669
[DEBUG   ] "GET /v1.26/version HTTP/1.1" 200 221
[DEBUG   ] dockerng.create is using the following kwargs to create container 'test' from image 'opensuse/python': {'host_config': {'NetworkMode': 'default'}, 'tty': True, 'stdin_open': True, 'command': 'sleep infinity'}
[DEBUG   ] "POST /v1.26/containers/create?name=test HTTP/1.1" 409 227
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 197, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 5900, in sls_build
    **create_kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 726, in wrapper
    returned = wrapped(*args, **salt.utils.clean_kwargs(**kwargs))
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 3155, in create
    **create_kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 696, in wrapper
    return wrapped(*args, **salt.utils.clean_kwargs(**kwargs))
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 993, in _client_wrapper
    exc.explanation)
CommandExecutionError: Error 409: {"message":"Conflict. The container name \"/test\" is already in use by container 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f. You have to remove (or rename) that container to be able to reuse that name."}
Error running 'dockerng.sls_build': Error 409: {"message":"Conflict. The container name \"/test\" is already in use by container 00e89df59ff97f3900f06eaa986ec83a84c0ce14cf8d1d5b2edddaaf41d02f0f. You have to remove (or rename) that container to be able to reuse that name."}

Delete the offending container and run again. Same error original post:

root@ubuntu-01:~# docker rm test; salt-call --local dockerng.sls_build "test" mods=vim -l debug
test
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Trying paths: ['/home/apcera/.docker/config.json', '/home/apcera/.dockercfg']
[DEBUG   ] No config file found
[DEBUG   ] "GET /version HTTP/1.1" 200 221
[DEBUG   ] "GET /v1.26/version HTTP/1.1" 200 221
[DEBUG   ] LazyLoaded dockerng.sls_build
[DEBUG   ] "GET /v1.26/images/opensuse/python/json HTTP/1.1" 200 1669
[DEBUG   ] "GET /v1.26/version HTTP/1.1" 200 221
[DEBUG   ] dockerng.create is using the following kwargs to create container 'test' from image 'opensuse/python': {'host_config': {'NetworkMode': 'default'}, 'tty': True, 'stdin_open': True, 'command': 'sleep infinity'}
[DEBUG   ] "POST /v1.26/containers/create?name=test HTTP/1.1" 201 90
[DEBUG   ] LazyLoaded mine.send
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] LazyLoaded network.interfaces
[DEBUG   ] LazyLoaded data.get
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "POST /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/start HTTP/1.1" 204 0
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/info HTTP/1.1" 200 None
[DEBUG   ] LazyLoaded container_resource.run
[DEBUG   ] LazyLoaded cmd.run_all
[INFO    ] Executing command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d -- mkdir -p /tmp/salt.dockerng.9611f0' in directory '/home/apcera'
[ERROR   ] Command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d -- mkdir -p /tmp/salt.dockerng.9611f0' failed with return code: 1
[ERROR   ] stderr: Error: container 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d is not defined
[ERROR   ] retcode: 1
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] compile template:
[ERROR   ] Template does not exist:
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG   ] Updating roots fileserver cache
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] Could not find file 'salt://vim.sls' in saltenv 'base'
[DEBUG   ] Could not find file 'salt://vim/init.sls' in saltenv 'base'
[DEBUG   ] compile template: False
[ERROR   ] Template was specified incorrectly: False
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[INFO    ] Executing command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d -- mkdir -p /tmp/salt.dockerng.ec7627' in directory '/home/apcera'
[ERROR   ] Command 'lxc-attach --clear-env --set-var PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  -n 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d -- mkdir -p /tmp/salt.dockerng.ec7627' failed with return code: 1
[ERROR   ] stderr: Error: container 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d is not defined
[ERROR   ] retcode: 1
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "POST /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/stop?t=10 HTTP/1.1" 204 0
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/json?all=1&limit=-1&trunc_cmd=0&size=0 HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/53d05946e6ba045b26eaaec455211d5b6726766b4a47404e48bae9ba8f55721f/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/9b055dc2910f06778ee9478e5629b40dbc810754be4e820f67c41089d63d6e08/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5414e0c998cecc7e46409abddd623d085eb56e6bf81ec66883e51c84aed2f535/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/a720d9dc2b79105871d4c14447a2c378b16f37c95d793c4ddcf510db8baaa567/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/bb6ce33036bd8f78b1226328229dc23f5a53bbed146c90393348925caf5cee54/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/c462fff4aa45933efed11c4144efc355b2ef419926db3d1ffbae028046964e66/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
[DEBUG   ] "GET /v1.26/containers/5d32aaed457de4071a0d71fffdbb5d6581a7a85e31a16a137535e5f161359d2b/json HTTP/1.1" 200 None
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 197, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 5909, in sls_build
    raise CommandExecutionError(ret)
CommandExecutionError: {'comment': 'Error: container 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d is not defined', 'result': False}
Error running 'dockerng.sls_build': {'comment': 'Error: container 36aaff0371620a046b71a7e5558f6c64382532dca8085d222ceca78ffe58227d is not defined', 'result': False}
sdemura commented 7 years ago

Also, for clarity, lxc and related tools are also installed:

root@ubuntu-01:~# dpkg -l | grep lxc
ii  liblxc1                            2.0.7-0ubuntu1~16.04.1          amd64        Linux Containers userspace tools (library)
ii  lxc                                2.0.7-0ubuntu1~16.04.1          all          Transitional package for lxc1
ii  lxc-common                         2.0.7-0ubuntu1~16.04.1          amd64        Linux Containers userspace tools (common tools)
ii  lxc-templates                      2.0.7-0ubuntu1~16.04.1          amd64        Linux Containers userspace tools (templates)
ii  lxc1                               2.0.7-0ubuntu1~16.04.1          amd64        Linux Containers userspace tools
ii  lxcfs                              2.0.6-0ubuntu1~16.04.1          amd64        FUSE based filesystem for LXC
ii  python-lxc                         0.1-0ubuntu6                    amd64        Linux container userspace tools (Python 2.x bindings)
ii  python3-lxc                        2.0.7-0ubuntu1~16.04.1          amd64        Linux Containers userspace tools (Python 3.x bindings)
gtmanfred commented 7 years ago

How did you setup docker to use lxc? By default, in 16.04 I am getting nsenter and systemd-nspawn containers?

Thanks, Daniel

sdemura commented 7 years ago

Using a vanilla Xenial VM, used these instructions: https://docs.docker.com/engine/installation/linux/ubuntu/

I haven't done any other config, so I'm curious why lxc is being used.

I'm going to downgrade to Docker 1.12 and see if anything changes.

gtmanfred commented 7 years ago

Ahh, i didn't use the docker repository directly, i just used the ubuntu provided docker... that could be it

On Wed, Mar 1, 2017 at 2:52 PM, sdemura notifications@github.com wrote:

Using a vanilla Xenial VM, used these instructions: https://docs.docker.com/engine/installation/linux/ubuntu/

I haven't done any other config, so I'm curious why lxc is being used.

I'm going to downgrade to Docker 1.12 and see if anything changes.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/saltstack/salt/issues/39764#issuecomment-283466199, or mute the thread https://github.com/notifications/unsubscribe-auth/AAssoSJPs90RUUNMSqT71hLOxKbbX7Zzks5rhdqAgaJpZM4MQF9p .

sdemura commented 7 years ago

Docker 1.12.6 from the official repo fails too, but in a different way:

root@ubuntu-01:/srv/salt# salt-call dockerng.sls_build "test-6" mods=vim
[WARNING ] ExecutionDriver from 'docker info' is blank, falling back to using 'nsenter'. To squelch this warning, set docker.exec_driver. See the Salt documentation for the dockerng module for more information.
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  mkdir -p /tmp/salt.dockerng.d89200' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  python /tmp/salt.dockerng.d89200/salt-call --metadata --local --out json -l quiet -- grains.items' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  rm -rf /tmp/salt.dockerng.d89200' in directory '/home/apcera'
[INFO    ] Loading fresh modules for state activity
[INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://vim.sls', mode up-to-date
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  mkdir -p /tmp/salt.dockerng.8a847a' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  test -d /tmp/salt.dockerng.8a847a/salt_state.tgz' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  test -d /tmp/salt.dockerng.8a847a' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  md5sum /tmp/salt.dockerng.8a847a/salt_state.tgz' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  md5sum /tmp/salt.dockerng.8a847a/salt_state.tgz' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  mkdir -p /tmp/salt.dockerng.dde5a6' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  python /tmp/salt.dockerng.dde5a6/salt-call --metadata --local --out json -l quiet -- state.pkg /tmp/salt.dockerng.8a847a/salt_state.tgz fc94b888205789be4ef50aa01424d2d63d1f838d21a9b6f3af65434c500c9fc7 sha256' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  rm -rf /tmp/salt.dockerng.dde5a6' in directory '/home/apcera'
[INFO    ] Executing command 'nsenter --target 28351 --mount --uts --ipc --net --pid -- env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin:/usr/local/bin:/usr/local/sbin  rm -rf /tmp/salt.dockerng.8a847a' in directory '/home/apcera'
Error running 'dockerng.sls_build': {'pkg_|-vim_|-vim_|-installed': {'comment': "State 'pkg.installed' was not found in SLS 'vim'\nReason: 'pkg' __virtual__ returned False\n", '__run_num__': 0, 'changes': {}, 'result': False, 'name': 'vim'}}

However I just saw this note in the documentation: https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.dockerng.html#executing-commands-within-a-running-container

With the release of Docker 1.13.1, the Execution Driver has been removed. Starting in versions 2016.3.6, 2016.11.4, and Nitrogen, Salt defaults to using docker exec to run commands in containers, however for older Salt releases it will be necessary to set the docker.exec_driver config option to either docker-exec or nsenter for Docker versions 1.13.1 and newer.

I'm going to try manually setting the exec driver

gtmanfred commented 7 years ago

I have replicated this issue if you use https://docs.docker.com/engine/installation/linux/ubuntu/ to set it up.

If you use nsenter, it looks like it works correctly.

I am marking this as a bug, thanks @dmacvicar you might be interested in this one.

Thanks, Daniel

sdemura commented 7 years ago

I just got this working with Docker 1.12.6 from the official repo after adding docker.exec_driver: docker-exec to my minion config.

At the very least, looks like a doc update is needed. Thanks for the help!

gtmanfred commented 7 years ago

No problem. Thanks for looking into this further!

Thanks, Daniel

dmacvicar commented 7 years ago

I started looking into this, unfortunately I could not get runtests.py to work in develop.

I suspect of:

[INFO    ] Executing command 'lxc-attach 

I will revisit it soon.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.