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

Cannot edit/duplicate a container when registry is not registered in Portainer #1140

Closed
masudak opened this issue Aug 22, 2017 · 25 comments · Fixed by #1143
Closed

Cannot edit/duplicate a container when registry is not registered in Portainer #1140

masudak opened this issue Aug 22, 2017 · 25 comments · Fixed by #1143

Comments

@masudak
Copy link

masudak commented Aug 22, 2017

Description
I started to use portainer from today, and want to edit environment variables through webui against a running container, but I can't with this error message.

Cannot read property 'URL' of undefined

Steps to reproduce the issue:

  1. I started portainer like this.
$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
  1. And accessed to webui, and set authentification.
  2. When I can see the running docker container to access /#/containers/, I choose a running container.
  3. And clicked the Duplicate/Edit button
  4. Clicked Env tab
  5. Changed a value
  6. Clicked Start container button
  7. I checked this sentence and clicked Replace.
A container with the same name already exists. Portainer can automatically remove it and re-create one. Do you want to replace it?
  1. I checked this uri called(it was DELETE method) and this response status was 200.
https://portainer-XXXXXXXX.com/api/endpoints/1/docker/containers/YYYYYY?force=true&v=1
  1. The target container was kill and removed, and docker logs optimistic_fermi(portainer's container name) was no output when this error was shown.

Is there any way to trace any other logs?

Technical details:

  • Portainer version:
$ docker images|grep porta
portainer/portainer                                 latest              47dbf4321bb4        8 days ago          10.7MB
  • Target Docker version (the host/cluster you manage):
$ rpm -qa|grep docker
docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch
docker-engine-17.05.0.ce-1.el7.centos.x86_64
  • Platform (windows/linux):
    GCP instance
$ uname -r
3.10.0-514.26.2.el7.x86_64
$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
  • Command used to start Portainer (docker run -p 9000:9000 portainer/portainer):
$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
  • Target Swarm version (if applicable):
    not used.

  • Browser:
    Google Chrome 60.0.3112.101(Official Build)
    on Mac 10.12.6

@deviantony
Copy link
Member

@masudak Can you open the browser developer console and check if there is any error ? Also where is this error displayed 'Cannot read property 'URL' of undefined' ? In a red notification message?

@masudak
Copy link
Author

masudak commented Aug 22, 2017

Console had this error.

app.33d6a946.js:3 TypeError: Cannot read property 'URL' of undefined
    at t (app.33d6a946.js:29)
    at B (app.33d6a946.js:29)
    at app.33d6a946.js:30
    at app.33d6a946.js:3
    at o.$eval (app.33d6a946.js:3)
    at o.$digest (app.33d6a946.js:3)
    at o.$apply (app.33d6a946.js:3)
    at i (app.33d6a946.js:2)
    at u (app.33d6a946.js:2)
    at XMLHttpRequest.y.onload (app.33d6a946.js:2)

Yes, Cannot read property 'URL' of undefined error was shown as red notification message on right top corner.

portainer_err

@deviantony
Copy link
Member

deviantony commented Aug 22, 2017

@masudak is it possible for you to give us the all the information about the container you wanted to edit/duplicate? All the parameters that you put in the container creation view? Or was it a container created from the CLI ?

@masudak
Copy link
Author

masudak commented Aug 22, 2017

There is one thing I found.
If I created new container from webui to click Add container, and set environment variables, it can be modified it after launched to click Start container to reflect the changes.

And if I used docker-compose like this, it worked too.

version: '2'
services:
  redis-sample:
    image: redis
    environment:
      KEY: VALUE

But if I used this compose file such as using GCR, it failed.

version: '2'
services:
  redis-sample-gcr:
    image: asia.gcr.io/foo/bar
    environment:
      KEY: VALUE

@WTFKr0
Copy link
Contributor

WTFKr0 commented Aug 22, 2017

Linked to Registry no ?
If we recreate a container (from a non dockerhub registry) and if this registry is not known to portainer ?

@masudak
Copy link
Author

masudak commented Aug 22, 2017

Is it necessary to be known to portainer for our registry? Or is there any tips to make it known to portainer?

@deviantony
Copy link
Member

deviantony commented Aug 22, 2017

Right this might be problematic indeed, I'll investigate a bit. Thanks for the details @masudak

EDIT: normally, if the registry is not known by Portainer, it should default to Dockerhub.

@masudak
Copy link
Author

masudak commented Aug 22, 2017

Thank you so much, let me know if I should investigate and submit more detail.

@deviantony deviantony added this to the 1.14.x milestone Aug 22, 2017
@WTFKr0
Copy link
Contributor

WTFKr0 commented Aug 22, 2017

@msudak
As a workaroud I think you can add the registry to portainer (Registries menu) with these infos :

Name : Asia GCR
URL : asia.gcr.io

Then when in Duplicate/Edit view, verify that the image and registry are ok before pressing "Start container"

@masudak
Copy link
Author

masudak commented Aug 22, 2017

@WTFKr0 I added the registry on Registries menu, and then it worked without any errors. Thank you so much!! I hope it will work without any manual operations!

@deviantony
Copy link
Member

I've created a PR to solve this issue (#1143). It's not really a fix as we cannot create a container from an unknow registry using the current registry management implementation in Portainer.

Instead, this PR will display a warning message and prevent the creation of the container by disabling the start container button.

@masudak @WTFKr0 what do you think about this?

@WTFKr0
Copy link
Contributor

WTFKr0 commented Aug 22, 2017

It's not really a fix as we cannot create a container from an unknow registry using the current registry management implementation in Portainer

I think you can
In my tests, I do that for example when creating a container :
Registry : Let default dockerhub
Image: set full path with registry (quay.io/coreos/etcd for example)

@WTFKr0
Copy link
Contributor

WTFKr0 commented Aug 22, 2017

So I think the fix can be :
If we cannot found the registry in portainer, we let Dockerhub and put full path in image text input

@masudak
Copy link
Author

masudak commented Aug 23, 2017

Your approach is better than now as a first measure, but how about making enabling to set command line option for a private registry such as below.

  portainer:
    image: portainer/portainer
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: >-
      --admin-password=$$XXXXXXX
      --add-registory={"Asia GCR": "asia.gcr.io"}
      --add-registory={"US GCR": "us.gcr.io"}
      --add-registory={"EU GCR": "eu.gcr.io "}
    ports:
      - "9000:9000"

@deviantony
Copy link
Member

@WTFKr0 If we default to Dockerhub with the full path in the image text input, this will not create the image expected by the user. So the user will probably have to create the registry right after that.

@masudak I'm not keen to support these kind of options on the CLI. I'd rather have CLI flags that alters the status of the Portainer binary not the data. We can still use the HTTP API to automate the creation of registries.

I'm thinking that there might be a way to circumvent the existing registry implementation when duplicating/editing a container, I can have a look.

@deviantony deviantony changed the title Couldn't apply changes of environment variables for container. Cannot edit/duplicate a container when registry is not registered in Portainer Aug 23, 2017
@masudak
Copy link
Author

masudak commented Aug 23, 2017

@deviantony

I'm not keen to support these kind of options on the CLI.

Okay, I got it.

I'm thinking that there might be a way to circumvent the existing registry implementation

Thanks, it helps me a lot!

@deviantony
Copy link
Member

deviantony commented Sep 5, 2017

#1143 has been merged as a temporary measure (container duplication is still considered experimental) but I'll keep this issue open as we should find a way to use unregistered registries as well.

@deviantony deviantony modified the milestone: 1.14.x Sep 14, 2017
@deviantony deviantony removed this from the 1.14.x milestone Oct 15, 2017
@deviantony deviantony added this to the 1.15.x milestone Oct 15, 2017
@knall0
Copy link

knall0 commented Nov 29, 2017

Maybe I discovered a related bug; Docker.io seems not to be recognized as the Dockerhub-Registry and the same Error occurs.
Steps to reproduce this Error:

  1. Start a (fresh) Portainer instance in docker
    docker run -d -p 9000:9000 --name="portainer" --privileged --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v /portainerdata:/data -e portainer/portainer:1.15.3
  2. Start a Jenkins instance in docker:
    docker run --privileged -p 8080:8080 -p 50000:50000 --name jenkins -v /jenkins/home:/var/jenkins_home jenkins/jenkins:2.73.2
  3. Go to container Jenkins and hit Duplicate/edit
  4. Edit Image Configuration Name to:
    docker.io/jenkins/jenkins:2.73.3
  5. Go again to container Jenkins and hit Duplicate/edit
    --> The Gui shows this Error:
    The Docker registry for the docker.io/jenkins/jenkins:2.73.3 image is not registered inside Portainer, you will not be able to create a container. Please register that registry first.

Workaround: If I use in step 4 the image tag jenkins/jenkins:2.73.3 instead - so without the docker.io/ - there will be no error. But the dropdown menu suggests only image tags with docker.io/, so this will be the first one to try.

I would try to recognize docker.io as dockerhub, so that the registry is registered.

@deviantony
Copy link
Member

Thanks for the report @knall0

We're currently reviewing the UX/functionalites regarding how you specify images inside Portainer, see the discussion in #1434

@deviantony deviantony modified the milestones: 1.15.x, next Jan 21, 2018
@deviantony deviantony removed this from the next milestone Apr 9, 2018
@xenek
Copy link

xenek commented Apr 22, 2018

Can confirm Knall0 issue...

"The Docker registry for the arm32v7/wordpress:latest image is not registered inside Portainer, you will not be able to create a container. Please register that registry first. "

While trying to duplicate/Edit the container.

@brando56894
Copy link

brando56894 commented Jun 11, 2018

This happens for pretty much all of my images.

@rmalca
Copy link

rmalca commented Jun 27, 2018

Temporary solution: Add the url docker.io in the Registries section.

@amo42
Copy link

amo42 commented Aug 2, 2018

I can confirm this happens for images from Docker Hub as well.

Portainer version 1.16.4

The workaround from @lweb20 did not work for me.

@stale
Copy link

stale bot commented Jul 19, 2019

This issue has been marked as stale as it has not had recent activity, it will be closed if no further activity occurs in the next 7 days. If you believe that it has been incorrectly labelled as stale, leave a comment and the label will be removed.

@stale stale bot added the status/stale label Jul 19, 2019
@stale
Copy link

stale bot commented Jul 26, 2019

Since no further activity has appeared on this issue it will be closed. If you believe that it has been incorrectly closed, leave a comment and mention @itsconquest. One of our staff will then review the issue.
Note - If it is an old bug report, make sure that it is reproduceable in the latest version of Portainer as it may have already been fixed.

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

Successfully merging a pull request may close this issue.

8 participants