FAQ
Hi,
I keep trying to install and then run a docker container using Salt. The
error I am getting is:
CommandExecutionError: Container_id None could not be resolved to an
existing container

I understand the problem - that dockerpy tries to run a container named
"None" so it most likely just doesn't see the name which should be passed
from the state file. But unfortunately I have no idea what to do to get
over this problem.
Logs and my states are pasted below. Can somebody please take a look and
help me a bit? Docker by itself gets installed fine and the container gets
pulled also just fine. When I go to the host and run container manually it
works ok. So I think the problem has to be somewhere with the dockerio
salt module....

runs ok manually:
vagrant@devVagrant:~$ sudo docker run -d -p 27017:27017 --name mongodb
fredmajor/rbdata
a8a7cc975c1e975217bdbda47c1e8b3c760fc24f1b9091c9c91bf03ebbf10b19

vagrant@devVagrant:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED
           STATUS PORTS NAMES
a8a7cc975c1e fredmajor/rbdata:latest "mongod" 5 seconds
ago Up 4 seconds 28017/tcp, 0.0.0.0:27017->27017/tcp mongodb


the image gets pulled:
vagrant@devVagrant:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED
     VIRTUAL SIZE
fredmajor/rbdata latest c37c07d02fe3 3 weeks ago
     713 MB


From logs:
----------
           ID: docker
     Function: service.running
       Result: True
      Comment: The service docker is already running
      Started: 21:39:30.281611
     Duration: 35.969 ms
      Changes:
----------
           ID: rbdata-image
     Function: docker.pulled
         Name: fredmajor/rbdata
       Result: True
      Comment: Image fredmajor/rbdata was pulled
(c37c07d02fe330c99e62b1f9a11a226297c26545b9ecdb5ede5dc741a8929910)
      Started: 21:39:30.318255
     Duration: 877787.096 ms
      Changes:
               ----------
               fredmajor/rbdata:
                   ----------
                   new:

c37c07d02fe330c99e62b1f9a11a226297c26545b9ecdb5ede5dc741a8929910
                   old:
                       None
----------
           ID: rbdata-container
     Function: docker.installed
         Name: rbdata
       Result: True
      Comment: Container
90559ae58c062124d193950d3d0ef6ca667c9c1bf3fce04072137ce3e6c97576 created
      Started: 21:54:08.105541
     Duration: 164.355 ms
      Changes: Invalid Changes data: Container
90559ae58c062124d193950d3d0ef6ca667c9c1bf3fce04072137ce3e6c97576 created
----------
           ID: rbdata
     Function: docker.run
       Result: False
      Comment: An exception occurred in this state: Traceback (most recent
call last):
                 File "/usr/lib/python2.7/dist-packages/salt/state.py", line
1533, in call
                   **cdata['kwargs'])
                 File
"/usr/lib/python2.7/dist-packages/salt/states/dockerio.py", line 605, in run
                   result = drun_all(cid, name)
                 File
"/usr/lib/python2.7/dist-packages/salt/modules/dockerio.py", line 1833, in
run_all
                   status, container, 'cmd.run_all', cmd)
                 File
"/usr/lib/python2.7/dist-packages/salt/modules/dockerio.py", line 1740, in
_run_wrapper
                   container_info = _get_container_infos(container)
                 File
"/usr/lib/python2.7/dist-packages/salt/modules/dockerio.py", line 346, in
_get_container_infos
                   container)
               CommandExecutionError: Container_id None could not be
resolved to an existing container
      Started: 21:54:08.270611
     Duration: 20.468 ms
      Changes:

Summary
------------
Succeeded: 8 (changed=2)
Failed: 1
------------
Total states run: 9

Relevant piece of my state tree:

---------------------------------------------------
include:
   - docker

rbdata-image:
   docker.pulled:
     - name: fredmajor/rbdata
     - require_in: rbdata-container

rbdata-container:
   docker.installed:
     - name: rbdata
     - image: fredmajor/rbdata
     - hostname: rbdata
     - require_in: rbdata

rbdata:
   docker.run:
     - container: rbdata
     - name: rbdata
     - image: fredmajor/rbdata
---------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ryan Lane at Nov 21, 2014 at 10:54 pm
    I think you want docker.running, rather than docker.run. running ensures a
    container is running and run runs a command in a container.
    On Fri, Nov 21, 2014 at 2:08 PM, Fred wrote:

    Hi,
    I keep trying to install and then run a docker container using Salt. The
    error I am getting is:
    CommandExecutionError: Container_id None could not be resolved to an
    existing container

    I understand the problem - that dockerpy tries to run a container named
    "None" so it most likely just doesn't see the name which should be passed
    from the state file. But unfortunately I have no idea what to do to get
    over this problem.
    Logs and my states are pasted below. Can somebody please take a look and
    help me a bit? Docker by itself gets installed fine and the container gets
    pulled also just fine. When I go to the host and run container manually it
    works ok. So I think the problem has to be somewhere with the dockerio
    salt module....

    runs ok manually:
    vagrant@devVagrant:~$ sudo docker run -d -p 27017:27017 --name mongodb
    fredmajor/rbdata
    a8a7cc975c1e975217bdbda47c1e8b3c760fc24f1b9091c9c91bf03ebbf10b19

    vagrant@devVagrant:~$ sudo docker ps
    CONTAINER ID IMAGE COMMAND CREATED
    STATUS PORTS NAMES
    a8a7cc975c1e fredmajor/rbdata:latest "mongod" 5
    seconds ago Up 4 seconds 28017/tcp, 0.0.0.0:27017->27017/tcp
    mongodb


    the image gets pulled:
    vagrant@devVagrant:~$ sudo docker images
    REPOSITORY TAG IMAGE ID CREATED
    VIRTUAL SIZE
    fredmajor/rbdata latest c37c07d02fe3 3 weeks ago
    713 MB


    From logs:
    ----------
    ID: docker
    Function: service.running
    Result: True
    Comment: The service docker is already running
    Started: 21:39:30.281611
    Duration: 35.969 ms
    Changes:
    ----------
    ID: rbdata-image
    Function: docker.pulled
    Name: fredmajor/rbdata
    Result: True
    Comment: Image fredmajor/rbdata was pulled
    (c37c07d02fe330c99e62b1f9a11a226297c26545b9ecdb5ede5dc741a8929910)
    Started: 21:39:30.318255
    Duration: 877787.096 ms
    Changes:
    ----------
    fredmajor/rbdata:
    ----------
    new:

    c37c07d02fe330c99e62b1f9a11a226297c26545b9ecdb5ede5dc741a8929910
    old:
    None
    ----------
    ID: rbdata-container
    Function: docker.installed
    Name: rbdata
    Result: True
    Comment: Container
    90559ae58c062124d193950d3d0ef6ca667c9c1bf3fce04072137ce3e6c97576 created
    Started: 21:54:08.105541
    Duration: 164.355 ms
    Changes: Invalid Changes data: Container
    90559ae58c062124d193950d3d0ef6ca667c9c1bf3fce04072137ce3e6c97576 created
    ----------
    ID: rbdata
    Function: docker.run
    Result: False
    Comment: An exception occurred in this state: Traceback (most recent
    call last):
    File "/usr/lib/python2.7/dist-packages/salt/state.py",
    line 1533, in call
    **cdata['kwargs'])
    File
    "/usr/lib/python2.7/dist-packages/salt/states/dockerio.py", line 605, in run
    result = drun_all(cid, name)
    File
    "/usr/lib/python2.7/dist-packages/salt/modules/dockerio.py", line 1833, in
    run_all
    status, container, 'cmd.run_all', cmd)
    File
    "/usr/lib/python2.7/dist-packages/salt/modules/dockerio.py", line 1740, in
    _run_wrapper
    container_info = _get_container_infos(container)
    File
    "/usr/lib/python2.7/dist-packages/salt/modules/dockerio.py", line 346, in
    _get_container_infos
    container)
    CommandExecutionError: Container_id None could not be
    resolved to an existing container
    Started: 21:54:08.270611
    Duration: 20.468 ms
    Changes:

    Summary
    ------------
    Succeeded: 8 (changed=2)
    Failed: 1
    ------------
    Total states run: 9

    Relevant piece of my state tree:

    ---------------------------------------------------
    include:
    - docker

    rbdata-image:
    docker.pulled:
    - name: fredmajor/rbdata
    - require_in: rbdata-container

    rbdata-container:
    docker.installed:
    - name: rbdata
    - image: fredmajor/rbdata
    - hostname: rbdata
    - require_in: rbdata

    rbdata:
    docker.run:
    - container: rbdata
    - name: rbdata
    - image: fredmajor/rbdata
    ---------------------------------------------------

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Fred at Nov 22, 2014 at 10:46 am
    Hey, that works! Thanks a lot! But now I am wondering what I really need the state "installed" for.. Since "pulled" already makes sure that the image is present..

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedNov 21, '14 at 10:08p
activeNov 22, '14 at 10:46a
posts3
users2

2 users in discussion

Fred: 2 posts Ryan Lane: 1 post

People

Translate

site design / logo © 2022 Grokbase