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

When using container_name in docker-compose problems with dc and imagestreams #301

Closed
surajssd opened this issue Nov 21, 2016 · 1 comment
Labels
component/OpenShift kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@surajssd
Copy link
Member

docker-compose file i am using:

$ cat docker-compose.yml 
version: "2"
services:
  rabbit:
    image: rabbitmq:3.6.1
    container_name: myfavrabbit
    ports:
     - "5672:5672"

deloying app

$ oc new-project rabbit
$ kompose --provider openshift up
We are going to create OpenShift DeploymentConfigs, Services and PersistentVolumeClaims for your Dockerized application. 
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead. 

INFO[0000] Successfully created Service: rabbit         
INFO[0000] Successfully created DeploymentConfig: rabbit 
INFO[0000] Successfully created ImageStream: rabbit     

Your application has been deployed to OpenShift. You can run 'oc get dc,svc,is,pvc' for details.

nothing happens

$ oc get dc
NAME      REVISION   DESIRED   CURRENT   TRIGGERED BY
rabbit    0          1         0         config,image(rabbit:3.6.1)

manually trigger the deployment from GUI

$ oc get events -w
LASTSEEN   FIRSTSEEN   COUNT     NAME      KIND      SUBOBJECT   TYPE      REASON    SOURCE    MESSAGE
LASTSEEN                        FIRSTSEEN                       COUNT     NAME      KIND               SUBOBJECT   TYPE      REASON              SOURCE                           MESSAGE
2016-11-21 15:16:27 +0000 UTC   2016-11-21 15:16:27 +0000 UTC   1         rabbit    DeploymentConfig               Normal    DeploymentCreated   {deploymentconfig-controller }   Created new replication controller "rabbit-1" for version 1
2016-11-21 15:16:27 +0000 UTC   2016-11-21 15:16:27 +0000 UTC   1         rabbit-1-deploy   Pod                 Normal    Scheduled   {default-scheduler }   Successfully assigned rabbit-1-deploy to 192.168.121.251
2016-11-21 15:16:29 +0000 UTC   2016-11-21 15:16:29 +0000 UTC   1         rabbit-1-deploy   Pod       spec.containers{deployment}   Normal    Pulled    {kubelet 192.168.121.251}   Container image "openshift/origin-deployer:v1.4.0-alpha.1" already present on machine
2016-11-21 15:16:29 +0000 UTC   2016-11-21 15:16:29 +0000 UTC   1         rabbit-1-deploy   Pod       spec.containers{deployment}   Normal    Created   {kubelet 192.168.121.251}   Created container with docker id 62ddc990d5c9; Security:[seccomp=unconfined]
2016-11-21 15:16:29 +0000 UTC   2016-11-21 15:16:29 +0000 UTC   1         rabbit-1-deploy   Pod       spec.containers{deployment}   Normal    Started   {kubelet 192.168.121.251}   Started container with docker id 62ddc990d5c9
2016-11-21 15:16:30 +0000 UTC   2016-11-21 15:16:30 +0000 UTC   1         rabbit-1-mmz6z   Pod                 Normal    Scheduled   {default-scheduler }   Successfully assigned rabbit-1-mmz6z to 192.168.121.251
2016-11-21 15:16:30 +0000 UTC   2016-11-21 15:16:30 +0000 UTC   1         rabbit-1   ReplicationController             Normal    SuccessfulCreate   {replication-controller }   Created pod: rabbit-1-mmz6z
2016-11-21 15:16:31 +0000 UTC   2016-11-21 15:16:31 +0000 UTC   1         rabbit-1-mmz6z   Pod       spec.containers{myfavrabbit}   Normal    Pulling   {kubelet 192.168.121.251}   pulling image " "
2016-11-21 15:16:31 +0000 UTC   2016-11-21 15:16:31 +0000 UTC   1         rabbit-1-mmz6z   Pod       spec.containers{myfavrabbit}   Warning   Failed    {kubelet 192.168.121.251}   Failed to pull image " ": couldn't parse image reference " ": invalid reference format
2016-11-21 15:16:31 +0000 UTC   2016-11-21 15:16:31 +0000 UTC   1         rabbit-1-mmz6z   Pod                 Warning   FailedSync   {kubelet 192.168.121.251}   Error syncing pod, skipping: failed to "StartContainer" for "myfavrabbit" with ErrImagePull: "couldn't parse image
reference \" \": invalid reference format"

2016-11-21 15:16:32 +0000 UTC   2016-11-21 15:16:32 +0000 UTC   1         rabbit-1-mmz6z   Pod       spec.containers{myfavrabbit}   Normal    BackOff   {kubelet 192.168.121.251}   Back-off pulling image " "
2016-11-21 15:16:32 +0000 UTC   2016-11-21 15:16:32 +0000 UTC   1         rabbit-1-mmz6z   Pod                 Warning   FailedSync   {kubelet 192.168.121.251}   Error syncing pod, skipping: failed to "StartContainer" for "myfavrabbit" with ImagePullBackOff: "Back-off pulling image
\" \""

2016-11-21 15:16:45 +0000 UTC   2016-11-21 15:16:31 +0000 UTC   2         rabbit-1-mmz6z   Pod                 Warning   FailedSync   {kubelet 192.168.121.251}   Error syncing pod, skipping: failed to "StartContainer" for "myfavrabbit" with ErrImagePull: "couldn't parse image
reference \" \": invalid reference format"

2016-11-21 15:16:45 +0000 UTC   2016-11-21 15:16:31 +0000 UTC   2         rabbit-1-mmz6z   Pod       spec.containers{myfavrabbit}   Normal    Pulling   {kubelet 192.168.121.251}   pulling image " "
2016-11-21 15:16:45 +0000 UTC   2016-11-21 15:16:31 +0000 UTC   2         rabbit-1-mmz6z   Pod       spec.containers{myfavrabbit}   Warning   Failed    {kubelet 192.168.121.251}   Failed to pull image " ": couldn't parse image reference " ": invalid reference format
[SNIP]

But when container_name is not used everything runs fine.

@surajssd surajssd added component/OpenShift kind/bug Categorizes issue or PR as related to a bug. labels Nov 21, 2016
@kadel
Copy link
Member

kadel commented Nov 25, 2016

Problem is that ConfigChange trigger in DeploymentConfig is using wrong containerName (rabbit instad of myfavrabbit). It has to match container name in spec.template.spec.containers[0].name

this gets generated

        "triggers": [
          {
            "type": "ConfigChange"
          },
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": [
                "rabbit"
              ],
              "from": {
                "kind": "ImageStreamTag",
                "name": "rabbit:3.6.1"
              }
            }
          }
        ],

it should look like this:

"triggers": [
          {
            "type": "ConfigChange"
          },
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": [
                "myfavrabbit"
              ],
              "from": {
                "kind": "ImageStreamTag",
                "name": "rabbit:3.6.1"
              }
            }
          }
        ],

@kadel kadel added this to the v0.2.1 release milestone Nov 29, 2016
cdrage added a commit to cdrage/kompose that referenced this issue Dec 8, 2016
Checks to see if "container_name" is used correctly in a docker-compose
file conversion and updates the changes respectively in the outputted
artifact files.

For example with container_name set as myfoobarname, the change will
correctly update the "containerNames" portion of the deployment-config
for OpenShift.

"imageChangeParams": {
  "automatic": true,
  "containerNames": [
    "myfoobarname"
  ],
  "from": {
    "kind": "ImageStreamTag",
    "name": "rabbit:3.6.1"
  }
}

Closes kubernetes#301
procrypt pushed a commit to procrypt/kompose that referenced this issue Dec 15, 2016
Checks to see if "container_name" is used correctly in a docker-compose
file conversion and updates the changes respectively in the outputted
artifact files.

For example with container_name set as myfoobarname, the change will
correctly update the "containerNames" portion of the deployment-config
for OpenShift.

"imageChangeParams": {
  "automatic": true,
  "containerNames": [
    "myfoobarname"
  ],
  "from": {
    "kind": "ImageStreamTag",
    "name": "rabbit:3.6.1"
  }
}

Closes kubernetes#301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/OpenShift kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants