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: Failed to create new container: Failed to get create_endpoint_config argspec #41239

Closed Modulus closed 7 years ago

Modulus commented 7 years ago

Description of Issue/Question

dockerng.running fails on all states with this error message: Comment: Failed to create new container: Failed to get create_endpoint_config argspec I have not looked into this salt-config in a while, But this setup worked in an earlier version. Which one I cannot say...

Setup

influxdb running:
  dockerng.running:
    - image: influxdb
    - name: influxdb
    - hostname: {{salt["grains.get"]("id")}}
    - port_bindings:
      - "8083:8083"
      - "8086:8086"
    - log_config:
        Type:  json-file
        Config:
          max-file: '20'
          max-size: '20m'

Even this wont work:
influxdb running:
  dockerng.running:
    - image: influxdb
    - name: influxdb
    - hostname: {{salt["grains.get"]("id")}}
    - port_bindings:
      - "8083:8083"
      - "8086:8086"

Steps to Reproduce Issue

(Include debug logs if possible and relevant.) Apply this state to any node running docker

Versions Report

Salt Version:
           Salt: 2016.11.4

Dependency Versions:
           cffi: Not Installed
       cherrypy: 3.2.2
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 0.9.1
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Oct 26 2016, 20:30:19)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-92-generic
         system: Linux
        version: Ubuntu 14.04 trusty
gtmanfred commented 7 years ago

Can you provide me any more information?

I am unable to replicate this issue with the same versions.

root@ub14:~# salt-call --local state.apply test
local:
----------
          ID: influxdb running
    Function: dockerng.running
        Name: influxdb
      Result: True
     Comment: Container 'influxdb' changed state.. Container 'influxdb' was created.
     Started: 17:21:36.924483
    Duration: 9257.323 ms
     Changes:
              ----------
              added:
                  ----------
                  Id:
                      a6d03278c7bf916e4609032f36e9d0129a300e4f0caa1a3f4d1ee3941485f338
                  Name:
                      influxdb
                  Time_Elapsed:
                      0.0452728271484
                  Warnings:
                      None
              image:
                  ----------
                  Layers:
                      ----------
                      Pulled:
                          - 42f494ab74b6
                          - fb5937da9414
                          - b72c99d03582
                          - 10a267c67f42
                          - b5b16c2e3705
                          - e43033fefcb1
                  Status:
                      Downloaded newer image for influxdb:latest
                  Time_Elapsed:
                      8.92809700966
              state:
                  ----------
                  new:
                      running
                  old:
                      None

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:   9.257 s
root@ub14:~# docker exec -ti influxdb hostname
ub14.c.gtmanfred-1263.internal
root@ub14:~# salt-call --local grains.get id
local:
    ub14.c.gtmanfred-1263.internal
root@ub14:~# cat /srv/salt/test.sls
influxdb running:
  dockerng.running:
    - image: influxdb
    - name: influxdb
    - hostname: {{salt["grains.get"]("id")}}
    - port_bindings:
      - "8083:8083"
      - "8086:8086"
    - log_config:
        Type:  json-file
        Config:
          max-file: '20'
          max-size: '20m'
root@ub14:~# salt-call --versions-report
Salt Version:
           Salt: 2016.11.4

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: 2.2.1
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.9.6
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Oct 26 2016, 20:30:19)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.1
            ZMQ: 4.1.6

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 4.4.0-75-generic
         system: Linux
        version: Ubuntu 14.04 trusty

What version of the python docker module are you using? Which version of the docker engine?

Can you provide the debug log of salt?

Thanks, Daniel

Modulus commented 7 years ago

docker-py version

sudo salt -C "G@role:test and *01" cmd.run "pip freeze | grep docker-py" Gives the following docker-py version. Which version do you use? Recommended version is 1.4.0 and above. But the later releases will not work...

dev-test01: docker-py==1.5.0

Docker engine version

sudo salt -C "G@role:test and *01" cmd.run "docker --version" dev-test01: Docker version 17.05.0-ce, build 89658be

salt log:

dev-test01:

      ID: python-pip-whl
Function: pkg.removed
  Result: True
 Comment: All targeted packages were removed.
 Started: 11:59:30.690320
Duration: 1208.398 ms
 Changes:   
          ----------
          python-pip:
              ----------
              new:
              old:
                  1.5.4-1ubuntu4
          python-pip-whl:
              ----------
              new:
              old:
                  1.5.4-1ubuntu4

      ID: pip-install
Function: pkg.installed
    Name: python-pip
  Result: True
 Comment: The following packages were installed/updated: python-pip
 Started: 11:59:32.226733
Duration: 5303.941 ms
 Changes:   
          ----------
          python-pip:
              ----------
              new:
                  1.5.4-1ubuntu4
              old:
          python-pip-whl:
              ----------
              new:
                  1.5.4-1ubuntu4
              old:

      ID: dockerpy
Function: pip.installed
    Name: docker-py == 1.5.0
  Result: True
 Comment: Python package docker-py == 1.5.0 was already installed
          All packages were successfully installed
 Started: 11:59:37.741287
Duration: 1332.367 ms
 Changes:   

      ID: docker.dependencies
Function: pkg.installed
  Result: True
 Comment: All specified packages are already installed
 Started: 11:59:39.073962
Duration: 5.432 ms
 Changes:   

      ID: docker.repository
Function: pkgrepo.managed
    Name: deb https://apt.dockerproject.org/repo ubuntu-trusty main
  Result: True
 Comment: Package repo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' already configured
 Started: 11:59:39.079650
Duration: 25.922 ms
 Changes:   

      ID: docker.purge.lxc-docker
Function: pkg.purged
    Name: lxc-docker
  Result: True
 Comment: All specified packages are already absent
 Started: 11:59:39.105823
Duration: 8.191 ms
 Changes:   

      ID: docker.installed
Function: pkg.installed
    Name: docker-engine
  Result: True
 Comment: Package docker-engine is already installed
 Started: 11:59:39.114799
Duration: 4.401 ms
 Changes:   

      ID: docker.expose.home
Function: environ.setenv
    Name: DOCKER_HOST
  Result: True
 Comment: Environ values were already set with the correct values
 Started: 11:59:39.119618
Duration: 0.843 ms
 Changes:   

      ID: docker/config.json
Function: file.managed
    Name: /home/ubuntu/.docker/config.json
  Result: True
 Comment: File /home/ubuntu/.docker/config.json is in the correct state
 Started: 11:59:39.120769
Duration: 13.69 ms
 Changes:   

      ID: docker.service.start
Function: service.running
    Name: docker
  Result: True
 Comment: The service docker is already running
 Started: 11:59:39.135193
Duration: 28.863 ms
 Changes:   

      ID: influxdb running
Function: dockerng.running
    Name: influxdb
  Result: False
 Comment: Failed to create new container: Failed to get create_endpoint_config argspec
 Started: 11:59:39.164363
Duration: 19.264 ms
 Changes:   

Summary for dev-test01

Succeeded: 10 (changed=2) Failed: 1

Total states run: 11 Total run time: 7.951 s

salt debug log

{ 'funargs': [ 'test', { 'saltenv': 'dev' } ], 'jid': '20170516135929891642', 'return': { 'service|-docker.service.start|-docker|-running': { 'comment': 'The service docker is already running', 'name': 'docker', 'start_time': '11:59:39.135193', 'result': True, 'duration': 28.863, '__run_num__': 9, 'changes': {

  },
  '__id__': 'docker.service.start'
},
'pkg_|-docker.dependencies_|-docker.dependencies_|-installed': {
  'comment': 'All specified packages are already installed',
  'name': 'ca-certificates',
  'start_time': '11:59:39.073962',
  'result': True,
  'duration': 5.432,
  '__run_num__': 3,
  'changes': {

  },
  '__id__': 'docker.dependencies'
},
'pkgrepo_|-docker.repository_|-deb https://apt.dockerproject.org/repo ubuntu-trusty main_|-managed': {
  'comment': "Package repo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' already configured",
  'name': 'deb https://apt.dockerproject.org/repo ubuntu-trusty main',
  'start_time': '11:59:39.079650',
  'result': True,
  'duration': 25.922,
  '__run_num__': 4,
  'changes': {

  },
  '__id__': 'docker.repository'
},
'pip_|-dockerpy_|-docker-py == 1.5.0_|-installed': {
  'comment': 'Python package docker-py == 1.5.0 was already installed\nAll packages were successfully installed',
  'name': 'docker-py == 1.5.0',
  'start_time': '11:59:37.741287',
  'result': True,
  'duration': 1332.367,
  '__run_num__': 2,
  'changes': {

  },
  '__id__': 'dockerpy'
},
'pkg_|-python-pip-whl_|-python-pip-whl_|-removed': {
  'comment': 'All targeted packages were removed.',
  'name': 'python-pip-whl',
  'start_time': '11:59:30.690320',
  'result': True,
  'duration': 1208.398,
  '__run_num__': 0,
  'changes': {
    'python-pip': {
      'new': '',
      'old': '1.5.4-1ubuntu4'
    },
    'python-pip-whl': {
      'new': '',
      'old': '1.5.4-1ubuntu4'
    }
  },
  '__id__': 'python-pip-whl'
},
'dockerng_|-influxdb running_|-influxdb_|-running': {
  'comment': 'Failed to create new container: Failed to get create_endpoint_config argspec',
  'name': 'influxdb',
  'start_time': '11:59:39.164363',
  'result': False,
  'duration': 19.264,
  '__run_num__': 10,
  'changes': {

  },
  '__id__': 'influxdb running'
},
'pkg_|-docker.installed_|-docker-engine_|-installed': {
  'comment': 'Package docker-engine is already installed',
  'name': 'docker-engine',
  'start_time': '11:59:39.114799',
  'result': True,
  'duration': 4.401,
  '__run_num__': 6,
  'changes': {

  },
  '__id__': 'docker.installed'
},
'environ_|-docker.expose.home_|-DOCKER_HOST_|-setenv': {
  'comment': 'Environ values were already set with the correct values',
  'name': 'DOCKER_HOST',
  'start_time': '11:59:39.119618',
  'result': True,
  'duration': 0.843,
  '__run_num__': 7,
  'changes': {

  },
  '__id__': 'docker.expose.home'
},
'file_|-docker/config.json_|-/home/ubuntu/.docker/config.json_|-managed': {
  'comment': 'File /home/ubuntu/.docker/config.json is in the correct state',
  'pchanges': {

  },
  'name': '/home/ubuntu/.docker/config.json',
  'start_time': '11:59:39.120769',
  'result': True,
  'duration': 13.69,
  '__run_num__': 8,
  'changes': {

  },
  '__id__': 'docker/config.json'
},
'pkg_|-pip-install_|-python-pip_|-installed': {
  'comment': 'The following packages were installed/updated: python-pip',
  'name': 'python-pip',
  'start_time': '11:59:32.226733',
  'result': True,
  'duration': 5303.941,
  '__run_num__': 1,
  'changes': {
    'python-pip': {
      'new': '1.5.4-1ubuntu4',
      'old': ''
    },
    'python-pip-whl': {
      'new': '1.5.4-1ubuntu4',
      'old': ''
    }
  },
  '__id__': 'pip-install'
},
'pkg_|-docker.purge.lxc-docker_|-lxc-docker_|-purged': {
  'comment': 'All specified packages are already absent',
  'name': 'lxc-docker',
  'start_time': '11:59:39.105823',
  'result': True,
  'duration': 8.191,
  '__run_num__': 5,
  'changes': {

  },
  '__id__': 'docker.purge.lxc-docker'
}

}, 'retcode': 2, 'success': True, 'cmd': '_return', '_stamp': '2017-05-16T11:59:39.378805', 'fun': 'state.apply', 'id': 'dev-test01', 'out': 'highstate' }

Modulus commented 7 years ago

I see you are using docker-py 2.2.1 I will check with this version.

Modulus commented 7 years ago

docker py 2.2.1 installed using this guide: https://docker-py.readthedocs.io/en/stable/

Results in: dev-test01:

      ID: influxdb image
Function: dockerng.image_present
    Name: influxdb
  Result: False
 Comment: State 'dockerng.image_present' was not found in SLS 'test'
          Reason: 'dockerng.image_present' is not available.
 Changes:   

      ID: influxdb running
Function: dockerng.running
    Name: influxdb
  Result: False
 Comment: State 'dockerng.running' was not found in SLS 'test'
          Reason: 'dockerng.running' is not available.
 Changes:   

Summary for dev-test01

Modulus commented 7 years ago

Versions report on the minion in question: Salt Version: Salt: 2016.11.4

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 1.5 docker-py: 2.2.1 gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed Jinja2: 2.7.2 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: 0.9.1 msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: 1.2.3 pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.6 (default, Jun 22 2015, 17:58:13) python-gnupg: Not Installed PyYAML: 3.10 PyZMQ: 14.0.1 RAET: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.0.5

System Versions: dist: Ubuntu 14.04 trusty machine: x86_64 release: 3.13.0-100-generic system: Linux version: Ubuntu 14.04 trusty

gtmanfred commented 7 years ago

Can you provide me with the state file you used to setup the environment above so that I can test that one directly, and not recreate it?

Thanks, Daniel

Modulus commented 7 years ago

We got it to work with ubuntu 16.04. I have no idea why it did not work for us with ubuntu 14.04. But you can close this. I can still send you the state files if you wish

gtmanfred commented 7 years ago

Hrm, if someone else brings it up I will ask them for it. Thanks for reporting back.

On Mon, May 22, 2017 at 6:44 AM, John Sigvald Skauge < notifications@github.com> wrote:

We got it to work with ubuntu 16.04. I have no idea why it did not work for us with ubuntu 14.04. But you can close this. I can still send you the state files if you wish

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