Thanks for the answers. I have 2 containers which need to work together: they are started by:
docker run -d --name "name1" test/image1:1
docker run -d -p 80:80 --name "name2" --link name1:name1 test/image2:1
The images are created with Jenkins and Docker. They're pushed to a private repository. I've pulled the images from the private repo so now the images are on my OpenShift-server.
So the first question is how do I have to perform the docker 'link' command in OpenShift.
The second question is that I can't start a container from the image (I'm on OpenShift Origin 1.1 on Centos7)
oc new-app ec2-xxx:5000/test/image1:1
specify --allow-missing-images to use this image name.
The 'new-app' command will match arguments to the following types:
1. Images tagged into image streams in the current project or the 'openshift' project
- if you don't specify a tag, we'll add ':latest'
2. Images in the Docker Hub, on remote registries, or on the local Docker engine
3. Templates in the current project or the 'openshift' project
4. Git repository URLs or local paths that point to Git repositories
A manual pull from the image of the registry is possible. I'm using selfsigned certificates:
[centos ]$ docker login ec2xxx:5000
WARNING: login credentials saved in /home/centos/.docker/config.json
[centos ]$ docker pull ec2-xxx:5000/test/image1:1
Trying to pull repository ec2-xxx:5000/test/image1: ... 1: Pulling from test/image1
cb6fb082434e: Pull complete
d4b2ba78e3b4: Pull complete
a6e95c2e4006: Pull complete
e5b8ef372059: Pull complete
9fd49db1519a: Pull complete
18fd13ace241: Pull complete
3a13fe6d067c: Pull complete
ad32405e6b07: Pull complete
0d31c447e494: Pull complete
9d0e8e26845f: Pull complete
8c2b81d41510: Pull complete
6bd8695f794a: Pull complete
2dd7a08ef976: Pull complete
3ab4a286479f: Pull complete
Status: Downloaded newer image for ec2-xxx:5000/test/image1
From: ccoleman redhat com
Date: Tue, 19 Jan 2016 08:57:31 -0500
Subject: Re: Dockerfile in OpenShift
To: rcarvalh redhat com
CC: dencowboy hotmail com; users lists openshift redhat com
Also, note that "translating an image to an app" is what new-app does.
You can run "oc new-app GIT_REPO -o yaml --dry-run" to see what new-app generates, and pipe that directly into the export command:
oc new-app ... | oc export -f - --as-template=foo > template.yaml
Which generates the final template to a file on disk.
You don't need to "translate" the Dockerfile to a template. Instead, you can create a Docker build that will build an image out of the Dockerfile and can be deployed in OpenShift.
You can also create a template that will automated the creation of a BuildConfig, a DeploymentConfig, a Service, etc, see this example:
In the example, the BuildConfig.spec.source refers to a git repository that contains a Dockerfile. You can also use an inline Dockerfile as a source of your BuildConfig:
OpenShift Developer Experience