Openhift online: Error in StartContainer - ErrImagePull: "unauthorized: Authentication required"
I am new to openshift and I have showstopper:
On my computer, I created a Dockerimage called restservice
and I tested it successfully:
docker run -d -p 8080:8080 restservice
Then I created an application in Openshift-Online with an image:
oc new-app restservice
I can see that the deployer module starts up and after failure creates a working module.
from
oc describe pod restservice-2-50n0h
I am getting the following error:
...
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
1m 1m 1 {default-scheduler } Normal Scheduled Successfully assigned restservice-2-50n0h to ip-172-31-54-238.us-west-2.compute.internal
41s 41s 1 {kubelet ip-172-31-54-238.us-west-2.compute.internal} spec.containers{restservice} Normal Pulling pulling image "restservice:latest"
39s 39s 1 {kubelet ip-172-31-54-238.us-west-2.compute.internal} spec.containers{restservice} Warning Failed Failed to pull image "restservice:latest": unauthorized: authentication required
39s 39s 1 {kubelet ip-172-31-54-238.us-west-2.compute.internal} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "restservice" with ErrImagePull: "unauthorized: authentication required"
55s 9s 2 {kubelet ip-172-31-54-238.us-west-2.compute.internal} Warning FailedSync Error syncing pod, skipping: failed to "SetupNetwork" for "restservice-2-50n0h_wgbeckmann" with SetupNetworkError: "Failed to setup network for pod \"restservice-2-50n0h_wgbeckmann(06f892b4-7568-11e7-914e-0a69cdf75e6f)\" using network plugins \"cni\": CNI request failed with status 400: 'Failed to execute iptables-restore: exit status 1 (iptables-restore: line 3 failed\n)\n'; Skipping pod"
I have no idea what authentication needs.
source to share
An invalid step is to pop the image to go online.
So these are the Steps:
-
Create image on local computer
docker build -t restservice .
-
Tag it with registry / username / image
docker tag restservice registry.starter-us-west2.openshift.com/myusername/myrestservice
-
Get your Openshift Registry Login Secret
oc whoami -t sr3grwkegr3kjrk42k2jrg34kb5k43g5k4jg53
(sr3 ... - output) -
Enter the Openshift Registry directory
docker login -u name@mail.com -p sr3grwkegr3kjrk42k2jrg34kb5k43g5k4jg53 https://registry.starter-us-west-2.openshift.com
-
Push the image into the registry
docker push registry.starter-us-west-2.openshift.com/myusername/myrestservice
-
Create a new app with an image
oc new-app myrestservice
That's all....
source to share