How to add a docker image from a private repository in dockerhub?


(Josemaria Thomas) #1

I could add microservice in iofog-controller whose docker images are public in the dockerhub.
To add a microservice from a private repository of the docker hub, I did docker login in the iofog-agent. But the iofog-agent log shows Failed to parse dockerCfgFile error while trying to add the microservice.

[02/20/2019 11:24:38.918] [INFO] [Process Manager] : NEW TASK ADDED
[02/20/2019 11:24:38.921] [INFO] [Container Manager] : creating “private/dockerimage”
[02/20/2019 11:24:38.921] [INFO] [Container Manager] : pulling “private/dockerimage” from registry
[02/20/2019 11:24:38.921] [WARN] [Process Manager] : ADD unsuccessfully container with name tBmdwzJZbq4xBWV2XQfCWYh4hZ8TCDV3 , error: Failed to parse dockerCfgFile
[02/20/2019 11:24:38.921] [WARN] [Process Manager] : Container tBmdwzJZbq4xBWV2XQfCWYh4hZ8TCDV3 ADD operation failed after 5 attemps


(Josemaria Thomas) #2

Note: I was able to successfully run the same docker image outside iofog


#3

For private repositories you need to add new registry using ‘iofog-controller registry add’ command with ‘private’ parameter and credentials. Then you can use new registry id while adding/updating microservice.

Also there may be some issue with docker config, try to check the file which is located in usersHomeFolder/.docker/config.json


(Josemaria Thomas) #4

I added a new registry using the below command:

iofog-controller registry add -U "registry.hub.docker.com" -r -l josemaria -p password -u 1 -e josemaria@mail.com

iofog-controller registry list lists the newly added registry as below

 {
  "id": 3,
  "url": "registry.hub.docker.com",
  "isPublic": false,
  "isSecure": null,
  "certificate": null,
  "requiresCert": null,
  "username": "josemaria",
  "password": "password",
  "userEmail": "josemaria@mail.com",
  "userId": 1
}

Tried adding a new microservice from ioFog controller from registry 3 but failed.

iofog-controller catalog add --name "imageservice" -x "josemaria/imageservice" --registry-id 3 -u 1 -a "josemaria/imageservice"

iofog agent log
[02/21/2019 09:29:20.672] [INFO] [Process Manager] : NEW TASK ADDED
[02/21/2019 09:29:20.680] [INFO] [Container Manager] : creating “josemaria/imageservice”
[02/21/2019 09:29:20.680] [INFO] [Container Manager] : pulling “josemaria/imageservice” from registry
[02/21/2019 09:29:22.141] [INFO] [Message Bus] : Check message bus server status
[02/21/2019 09:29:23.443] [WARN] [Process Manager] : ADD unsuccessfully container with name YWN6NvxzGmkrd8kNyJgxkZcGtCbrgFkM , error: pull access denied for josemaria/imageservice, repository does not exist or may require ‘docker login’


#5

There was a bug with private repos and we fixed this one, the fix will be available in the next release in a few days (probably on Monday).


#6

Released new versions of Agent and Controller, should work fine with private repositories now.