I have created a deployment in openshift via webconsle where I am deploying a docker image from docker hub. I have selected the latest image while creating a deployment in web console where my image looks like hub.docker.com/test/test1:latest. So, currently the latest image is with tag 1 and it is running smoothly in the openshift console in a node.
Now for example I change my dockerfile and update the docker image in dockerhub with the latest tag 2 so what I am trying to do from a oc console is that I am trying to update the latest image in the openshift deployment to 2. I tried command oc rollout deployment name but it is giving me error that there is no deployment but I am still not sure about my command.
Any help and suggestions are appreciated.
Related
Hi i have problem with updating / changing image of my service on the server running Docker swarm mode.
Here is the process of manually updating the service.
push the project to gitlab from local machine.
pull the project from gitlab in server.
build a Docker image as my-project:latest
tag my-project:latest as registry.gitlab.com/my-group/my-project:staging
i push the image using docker push registry.gitlab.com/my-group/my-project:staging
i run docker stack deploy -c ~/docker-stack.yml api --with-registry-auth
and it works fine.
However if i move the codes above into a gitlab-ci.yml despite of ending the job successfully i get an error when it is trying to update the service.
Updating service api_backend (id: r4gqmil66kehzf0oehzqk57on)
image registry.gitlab.com/my-group/my-project:staging could not be accessed on a registry to record
its digest. Each node will access registry.gitlab.com/my-group/my-project:staging independently,
possibly leading to different nodes running different
versions of the image.
Also the gitlab runner is executing commands in Shell mode.
I have tried different solutions as you can see i'm even using the --with-registry-auth flag.
To summarize this:
everything works fine if i enter the codes manually but i get an error when i use gitlab-ci.yml.
I am using circleci to build images and export them as tar.gz using docker version 18.
But now I have docker 19 on all of my swarm manager and worker.
I have done the following steps to deploy services in swarm.
Load docker images using docker load command
Run docker stack deploy servername to deploy
I have tested it, and it works fine but I want to know is it the right thing to do?
It works for sure.
Here is a link with the breaking changes and incompatibilities of docker :
Documentation
When you build a public image, you cannot know the versions of docker which will pulling it, the compatibility is an important thing for the ecosystem of docker.
I have created the docker image using .net core2.1 in my machine. then I pushed that image to my docker hub account. after that, I like to deploy that docker image in the azure open shift. I am using deploy image option in openshift. I got this issue.
Failed to pull image "myaccountname/docker-repository#sha256:ebe91623041fa6ccc4244b038": rpc error: code = Unknown desc = image operating system "windows" cannot be used on this platform
I am very new to Openshift Origin. I am now trying out the possibility of deploying my docker containers in OpenShift origin.
For that I created a very simple docker container that adds two numbers and produce the result:
https://github.com/abrahamjaison01/openshifttest
I created a docker image locally and a public docker image in docker hub:
docker pull abrahamjaison/openshifttest
I run the docker image locally as follows:
[root#mymachine /]# docker run -it --rm abrahamjaison/openshifttest
Enter first large number
12345
Enter second large number
54321
Result of addition = 66666
Since I am completely new to Openshift, I have no idea on how to deploy this in the Openshift environment.
I created a new project: oc new-project openshifttest
Then a new app: oc new-app docker.io/abrahamjaison/openshifttest
But then I do not know how I can access the console/terminal to provide the inputs. Also many a times when I run this I get the output as "deployment failed" when I issue the command "oc status".
Basically I would like to know how I can deploy this docker image on openshift and how I will be able to access the terminal to provide the inputs for performing the addition.
Could someone help me out with this?
OpenShift is principally for long running services such as web application and database. It isn't really intended for running a Docker container to wrap a command which then returns a result to the console and exits.
To get a better understand of how OpenShift 3 is used, download and read the free eBook at:
https://www.openshift.com/promotions/for-developers.html
The closest you will get to do the same as docker run is the oc run command, but it sort of defeats the whole point of what OpenShift is for. You are better off using Docker on your own system for what you are describing.
A guess at the command you would use if really wanted to try would be:
oc run test -i --tty --rm --image=abrahamjaison/openshifttest
As I say though, not really intended for doing this. That oc run exists is more for testing when having deployment problems for your applications.
Following the "Creating an Application From an Image" part, the syntax should be:
oc new-app abrahamjaison/openshifttest
By default, OpenShift will look for the image in DockerHub.
But that supposes you have pushed your GitHub image there first: see "Store images on Docker Hub". That might be the missing step in your process.
The interaction with oc is done with the OpenShift CLI or web console, as illustrated in the authentication page.
I'm starting with Docker and OpenShift v3.
I have a simple Node.js project and a Dockerfile basically copied from nodejs.org that runs perfectly fine on my local machine with docker run. I pushed my image to Docker Hub and then created my project via oc new-project.
After oc new-app and oc get pods, I see a pod with status ImagePullBackOff and another as Running. After sometime, only one pod lasts, with status Error. oc logs only brings me: pods for deployment took longer than 600 seconds to become ready.
Another thing that probably could help is that, after the oc new-app command, I got a message like * [WARNING] Image runs as the 'root' user which may not be permitted by your cluster administrator.
Am I doing something wrong or missing something? Is more info needed?
You can see my Docker file in here and my project's code in here.
By default OpenShift will prevent you from running containers as root due to the security risk. Whether you can configure a cluster to allow you to run a specific container as root will depend on what privileges you have to administer the cluster.
You are better off not running your container as root in the first place. To do that suggest you use the image at:
https://hub.docker.com/r/ryanj/centos7-s2i-nodejs/
This image is Source-to-Image (S2I) enabled and so integrates with OpenShift's build system.