force_pull_image option doesn't works

Issue #69 closed
IT Expert created an issue

Hi. Looks like force_pull_image option doesn't work.

# Force the pull of container image before starting it. If set to False, will pull image
# only if image is not present in slave host.
    force_pull_image: True

I have checked it on mesos 1.3.0 and 1.5.0 versions, but no luck. How to repeat.

  1. Pull some image from docker-hub (like alpine)

  2. Push it to private docker images registry (https://github.com/vmware/harbor) with some tag, like 0.1.

  3. Run job with it image, it will be cached on slave node.

  4. Make changes, like add new files and push it to docker registry with the same label (0.1).

  5. Run job on node with this cached image. Slave doesn't pull updated image from registry it will use cached one.

Comments (10)

  1. Olivier Sallou repo owner

    Used to work. Will have to check mesos interface modifications. By default, mesos doesn't pull image if already present. This flag asks mesos to force the pull (at least it should) in offer accept

  2. IT Expert reporter

    https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto

    Looks like it there line 2737

     // With this flag set to false, the mesos containerizer will pull
      // the docker/appc image from the registry even if the image is
      // already downloaded on the agent.
      optional bool cached = 4 [default = true];
    

    Need to add it there for mesos containerizer:

      if self.cfg['mesos']['unified']:
                # Host mode only for the moment
                # => no port mapping or possible conflict
                # Need Calico or equivalent to have per task IP and network isolation
                # More doc:
                # https://github.com/projectcalico/calico-containers/blob/v0.19.0/README.md
                # http://mesos.apache.org/documentation/latest/networking-for-mesos-managed-containers/
    
                task['command']['shell'] = True
                docker = {
                    'image': {
                        'type': 'DOCKER',
                        'docker': {'name': job['container']['image']}
                    }
                }
    
  3. Olivier Sallou repo owner

    Just had a look at code, and force is set only in docker containerizer,not unified cont. Will need to update this in mesos plugin

  4. Olivier Sallou repo owner

    In mesos.py at unified test should update code like

    task['command']['shell'] = True docker = { 'image': { 'type': 'DOCKER', 'docker': {'name': job['container']['image']} } }

    If self.cfg['mesos']['force_pull_image']: docker['image']['cached'] = False

    Le ven. 2 mars 2018 13:04, olivier sallou olivier.sallou@gmail.com a écrit :

    [image: xriser] xriser commented on issue #69: force_pull_image option doesn't works https://bitbucket.org/osallou/go-docker/issues/69/force_pull_image-option-doesnt-works

    https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto

    Looks like it there line 2737

    // With this flag set to false, the mesos containerizer will pull // the docker/appc image from the registry even if the image is // already downloaded on the agent. optional bool cached = 4 [default = true];

    View this issue https://bitbucket.org/osallou/go-docker/issues/69/force_pull_image-option-doesnt-works or add a comment by replying to this email. Unsubscribe from issue emails https://bitbucket.org/api/1.0/repositories/osallou/go-docker/issue/69/unsubscribe/osallou/c625acce8dc81dc9bae9eacea7771225abcd2af7/ for this repository. [image: Bitbucket] https://bitbucket.org

  5. Olivier Sallou repo owner

    As i can't access my compute machine, would you mind doing a PR on branch develop for this specific bug?

    Thanks

  6. Log in to comment