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

How to tell if it is using dockerio (deprecated) or dockerng? #64

Closed
davidcodesido opened this issue Jan 8, 2016 · 3 comments
Closed

Comments

@davidcodesido
Copy link

I've run into an issue while using docker-formula's compose-ng. With the following pillar data:

docker:
  compose:
    registry-data:
      dvc: True
      image: registry:2
      container_name: &dvc 'registry-data'
      command: echo *dvc data volume container
      volumes:
        - /opt/docker-registry/data:/var/lib/registry
    registry:
      image: registry:2
      container_name: 'registry'
      restart: 'always'
      volumes_from:
        - 'registry-data'
      environment:
        REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: '/var/lib/registry'
      ports:
        - 127.0.0.1:5000:5000
    nginx:
      image: nginx:1.9
      restart: 'always'
      ports:
        - 5043:443
      links:
        - registry:registry
      volumes:
        - /etc/docker-registry/nginx/:/etc/nginx/conf.d
        - /etc/docker-registry/auth/:/etc/nginx/conf.d/auth
        - /etc/docker-registry/certs/:/etc/nginx/conf.d/certs

It ends up calling dockerio which seems to have a but parsing the image tag throwing an exception. I managed to overcome it by modifying the source code of /usr/lib/python2.7/dist-packages/salt/states/dockerio.py

FROM

def _get_image_name(image, tag):
    if ':' not in image:
        # backward compatibility: name could be already tagged
        return ':'.join((image, tag))
    return image

TO:

def _get_image_name(image, tag):
    if ':' not in image:
        # backward compatibility: name could be already tagged
        return ':'.join((image, str(tag)))
    return image

Which I consider ugly and unmaintainable.

Versions:
docker-py (1.6.0)
salt-common 2015.8.3+ds-1
salt-master 2015.8.3+ds-1
salt-minion 2015.8.3+ds-1

So, not sure if there's a mistake in my pillar or if it is something with dockerio or with this docker formula and how it passes the values to dockerio or if it should call something else. Sorry, still quite new on salt-docker. Let me know if I can provide further info.

@cdarwin
Copy link
Contributor

cdarwin commented Jan 29, 2016

At the time of writing the compose-ng formula, we were relying on the dockerio salt modules/states. A bit confusing, I suppose… I will add this caveat to the documentation initially and try to update the formula when I get a chance.

@noelmcloughlin
Copy link
Member

noelmcloughlin commented Feb 22, 2018

Hi @davidcodesido @cdarwin
I have tested compose-ng recently and it used lxc-docker-1.6.2 until I figured out pillar data was the issue. I've raised two PR, #135 and #137 to improve the situation. More extensive examples in README and pillar.example of compose user case would still be nice.

@noelmcloughlin
Copy link
Member

This is actually yaml idiosyncrasy according to saltstack documentation:

To ensure the object becomes a string, it should be surrounded by quotes. More information here.

The `pillar.example' has updated examples wrapped in quotes.

  compose:
    registry-datastore:
      dvc: True
      # image: &registry_image 'docker.io/registry:latest'  {#Fedora #}
      image: &registry_image 'registry:latest'  {# ubuntu/suse #}

<cut>

 nginx-latest:
      #image: 'docker.io/nginx:latest'  {# Fedora #}
      image: 'nginx:latest'     {# ubuntu/suse #}

I have been caught by this issue in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants