Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to apply configuration for the following parameters: network_mode #41765

Closed
gildor7 opened this issue Jun 15, 2017 · 6 comments
Closed
Labels
info-needed waiting for more info stale
Milestone

Comments

@gildor7
Copy link

gildor7 commented Jun 15, 2017

Description of Issue/Question

dockerng.running restarts my images every time (as expected) but fails giving this error:

Failed to apply configuration for the following parameters: network_mode

Setup

{% set appname = pillar['appname'] %}
{% set version = pillar['version'] %}

build_image:
  dockerng.image_present:
    - name: {{ appname }}:{{ version }}
    - build: /data/dockerfile/{{ appname }}

stop_container:
  dockerng.stopped:
    - names:
      - {{ appname }}
    - require:
      - dockerng: build_image

run_app:
  dockerng.running:
    - name: {{ appname }}
    - image: {{ appname }}:{{ version }}
    - port_bindings: 9000:9000
    - require:
      - dockerng: stop_container

Steps to Reproduce Issue

The first run just works fine, but the second run i get the following error:

----------
          ID: run_app
    Function: dockerng.running
        Name: rt-auth
      Result: False
     Comment: Container 'application' changed state.. Failed to apply configuration for the following parameters: network_mode.
     Started: 13:49:18.480531
    Duration: 9652.4 ms
     Changes:
              ----------
              added:
                  ----------
                  Id:
                      5a69709cc7e49a961032a58268d25d67d663ffe263f7341a4637a43ee487ae57
                  Name:
                      application
                  Time_Elapsed:
                      0.292793989182
                  Warnings:
                      None
              diff:
                  ----------
              removed:
                  - c9eb5b927976c5d594f46d64a83ee2c38f49672555a37bd846f7f8ee468b710e
              state:
                  ----------
                  new:
                      running
                  old:
                      stopped

I added "- network_mode: bridge", but adding it fixed the error label but not start the container.

If i look in the debug log of salt i see the following:

2017-06-15 13:49:28,130 [salt.state ][ERROR ][14120] {'diff': {}, 'state': {'new': 'running', 'old': 'stopped'}, 'removed': [u'c9eb5b927976c5d594f46d64a83ee2c38f49672555a37bd846f7f8ee468b710e'], 'added': {'Time_Elapsed': 0.29279398918151855, 'Name': 'application', u'Id': u'5a69709cc7e49a961032a58268d25d67d663ffe263f7341a4637a43ee487ae57', u'Warnings': None}}

Versions Report

Salt Version:
           Salt: 2016.11.5

Dependency Versions:
           cffi: Not Installed
       cherrypy: unknown
       dateutil: 1.4.1
      docker-py: 1.10.6
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.20.2
           Mako: 0.3.4
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.0.1
   pycryptodome: 3.4.3
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, Aug  9 2016, 06:11:56)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: redhat 6.9 Santiago
        machine: x86_64
        release: 2.6.32-696.3.1.el6.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 6.9 Santiago
@gtmanfred
Copy link
Contributor

I am unable to replicate this error using different container images to simulate an update.

Could you provide me with some steps to replicate this issue?

Thanks,
Daniel

@gtmanfred gtmanfred added the info-needed waiting for more info label Jun 15, 2017
@gtmanfred gtmanfred added this to the Blocked milestone Jun 15, 2017
@gildor7
Copy link
Author

gildor7 commented Jun 16, 2017

My dockerfile is:

FROM java:8
ADD app.zip /app/test/
ADD application.conf /app/test/
ADD logger.xml /app/test/
RUN cd /app/test && unzip app.zip
EXPOSE 9000
CMD /app/test/bin/application-Dconfig.file=/app/test/application.conf -Dlogger.file=/app/test/logger.xml -Dhttp.port=9000

I think this part is sufficient to replicate the issue:

FROM java:8
EXPOSE 9000

@gtmanfred
Copy link
Contributor

Hrm, I am stlll unable to replicate this issue.

local:
----------
          ID: build_image
    Function: dockerng.image_present
        Name: test:4
      Result: True
     Comment: Image 'test:4' was built
     Started: 13:48:45.226262
    Duration: 1029.675 ms
     Changes:
              ----------
              Id:
                  ee09d8418716
              Time_Elapsed:
                  0.0436298847198
----------
          ID: stop_container
    Function: dockerng.stopped
        Name: test
      Result: True
     Comment: Container 'test' is not running
     Started: 13:48:46.256480
    Duration: 5.897 ms
     Changes:
----------
          ID: run_app
    Function: dockerng.running
        Name: test
      Result: True
     Comment: Container 'test' changed state.. Container 'test' was replaced. Image changed from 'test:3' to 'test:4'.
     Started: 13:48:46.262895
    Duration: 569.895 ms
     Changes:
              ----------
              added:
                  ----------
                  Id:
                      931f1e78e1602b08678624e1a2290314ae66d516a52bf129f01e84ec5014fb66
                  Name:
                      test
                  Time_Elapsed:
                      0.0432069301605
                  Warnings:
                      None
              diff:
                  ----------
                  image:
                      ----------
                      new:
                          test:4
                      old:
                          test:3
              removed:
                  - b0f8180c3a3bc90bcdfe1b808972d708b8fe7dc73cd8294e48a56807a242e23a
              state:
                  ----------
                  new:
                      running
                  old:
                      stopped

Summary for local
------------
Succeeded: 3 (changed=2)
Failed:    0
------------
Total states run:     3
Total run time:   1.605 s
[root@salt salt]# tail -c +0 /srv/salt/{Docker*,test.sls}
==> /srv/salt/Dockerfile <==
FROM java:8
EXPOSE 9000

ADD test4 /tmp/test4

==> /srv/salt/test.sls <==
build_image:
  dockerng.image_present:
    - name: test:4
    - build: /srv/salt

stop_container:
  dockerng.stopped:
    - name: test
    - require:
      - dockerng: build_image

run_app:
  dockerng.running:
    - name: test
    - image: test:4
    - port_bindings: 9000:9000
    - require:
      - dockerng: stop_container

And I am on 2016.11.5, it looks like network_mode might be set to bridge by default.

@gildor7
Copy link
Author

gildor7 commented Jun 16, 2017

diff:
                     ----------
      image:
                      ----------
                      new:
                          test:4
                      old:
                          test:3

I think this is the problem because you can't replicate. Try to build and run with the same tag.

@gtmanfred
Copy link
Contributor

If I used the same version, then it just starts it again.

[root@salt ~]# salt-call --local state.apply test
local:
----------
          ID: build_image
    Function: dockerng.image_present
        Name: test:4
      Result: True
     Comment: Image 'test:4' already present
     Started: 14:56:25.939221
    Duration: 4.644 ms
     Changes:
----------
          ID: stop_container
    Function: dockerng.stopped
        Name: test
      Result: True
     Comment: Container 'test' is not running
     Started: 14:56:25.944325
    Duration: 7.237 ms
     Changes:
----------
          ID: run_app
    Function: dockerng.running
        Name: test
      Result: True
     Comment: Container 'test' changed state.
     Started: 14:56:25.952213
    Duration: 518.748 ms
     Changes:
              ----------
              state:
                  ----------
                  new:
                      running
                  old:
                      stopped

Summary for local
------------
Succeeded: 3 (changed=1)
Failed:    0
------------
Total states run:     3
Total run time: 530.629 ms

@stale
Copy link

stale bot commented Nov 5, 2018

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.

@stale stale bot added the stale label Nov 5, 2018
@stale stale bot closed this as completed Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed waiting for more info stale
Projects
None yet
Development

No branches or pull requests

2 participants