Skip to content

All services in docker-compose not mapped to OpenShift services #8943

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

Closed
surajssd opened this issue May 19, 2016 · 5 comments
Closed

All services in docker-compose not mapped to OpenShift services #8943

surajssd opened this issue May 19, 2016 · 5 comments

Comments

@surajssd
Copy link
Contributor

I am trying oc import docker-compose with the following docker-compose file. When imported the OpenShift template that is generated looks like this. So with this new feature, with the intoductory mail it said:

Each service in the compose file is converted to its own deployment config.
Each deployment config gets a Kubernetes service created that serves the ports exposed by each compose service

So this docker-compose file has 5 services, when imported it does get converted to 5 different DeploymentConfigs but not 5 different services. The reason I believe is the fact that the mail also says:

Containers that share volumes or the local network are colocated in the same pod.

So this docker-compose file has two networks(front-tier and back-tier), two services(voting-app and result-app) share network front-tier while back-tier is shared by everyone. There is complicated sharing of networks.

And so all of these services in docker-compose are not mapped with the services in OpenShift the application is not able to communicate within, most of the services call each other by name and since service does not exist it fails.

compose file:

$ cat docker-compose.yml 
version: "2"

services:
  voting-app:
    build: ./voting-app/.
    volumes:
     - ./voting-app:/app
    ports:
      - "5000:80"
    networks:
      - front-tier
      - back-tier

  result-app:
    build: ./result-app/.
    volumes:
      - ./result-app:/app
    ports:
      - "5001:80"
    networks:
      - front-tier
      - back-tier

  worker:
    image: manomarks/worker
    networks:
      - back-tier

  redis:
    image: redis:alpine
    container_name: redis
    ports: ["6379"]
    networks:
      - back-tier

  db:
    image: postgres:9.4
    container_name: db
    volumes:
      - "db-data:/var/lib/postgresql/data"
    networks:
      - back-tier

volumes:
  db-data:

networks:
  front-tier:
  back-tier:
Version
$ openshift version
openshift v1.3.0-alpha.0-559-g14d77ab-dirty
kubernetes v1.3.0-alpha.1-331-g0522e63
etcd 2.3.0
Steps To Reproduce
$ git clone https://github.com/docker/docker-birthday-3
$ cd docker-birthday-3/example-voting-app/
$ oc import docker-compose -f docker-compose.yml
Current Result

So currently when this application is imported the state of the application looks like this:

pods:

$ oc get pods
NAME                 READY     STATUS             RESTARTS   AGE
db-1-bvyt2           1/1       Running            0          59m
redis-1-uj8o0        1/1       Running            0          58m
result-app-1-build   0/1       Completed          0          59m
result-app-1-k2f9b   0/1       CrashLoopBackOff   16         58m
voting-app-1-build   0/1       Completed          0          59m
voting-app-1-vs4zo   0/1       CrashLoopBackOff   16         58m
worker-1-84j6a       1/1       Running            0          58m

services

$ oc get svc
NAME         CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
redis        172.30.248.149   <none>        6379/TCP   59m
result-app   172.30.56.62     <none>        80/TCP     59m
voting-app   172.30.185.123   <none>        80/TCP     59m
@surajssd surajssd changed the title All services in docker-compose not mapped to OpenShift serives All services in docker-compose not mapped to OpenShift services May 20, 2016
@concaf
Copy link

concaf commented May 20, 2016

@surajssd - The reason OpenShift does not create a service for db and worker is because the ports are not declared in the docker-compose.yaml file.

Also, OpenShift is unable to identify to-be-exposed ports when you do a oc expose pod --name db db-1-oduck

So, either do a oc expose --port=5432 pod --name db db-1-oduck or declare the port in docker-compose.yaml. I have tried for this example and both of these work!

However, name resolution not working might break some Docker Compose applications which are being run using oc import docker-compose ...

@smarterclayton does it make sense if OpenShift could resolve names for the services mentioned in docker-compose.yaml even if their corresponding services are not created in OpenShift?

@surajssd
Copy link
Contributor Author

@containscafeine so yes I tried adding ports in the db and it has a service now, so that part I was missing. Thanks for finding that out 👍

@smarterclayton
Copy link
Contributor

Unfortunately services and names are linked in Kubernetes, so you can't get
names without the service. Definitely though the tool should be better at
communicating that you have no services because you have no ports so that
you know.

On Fri, May 20, 2016 at 9:06 AM, Shubham [email protected] wrote:

@surajssd https://github.com/surajssd - The reason OpenShift does not
create a service for db and worker is because the ports are not declared
in the docker-compose.yaml file.

Also, OpenShift is unable to identify to-be-exposed ports when you do a oc
expose pod --name db db-1-oduck

So, either do a oc expose --port=5432 pod --name db db-1-oduck or declare
the port in docker-compose.yaml. I have tried for this example and both
of these work!

However, name resolution not working might break some Docker Compose
applications which are being run using oc import docker-compose ...

@smarterclayton https://github.com/smarterclayton does it make sense if
OpenShift could resolve names for the services mentioned in
docker-compose.yaml even if their corresponding services are not created
in OpenShift?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8943 (comment)

@surajssd
Copy link
Contributor Author

Yes that makes sense!

@smarterclayton
Copy link
Contributor

Fixed in #9009

On Tue, May 24, 2016 at 2:02 AM, Suraj Deshmukh [email protected]
wrote:

Yes that makes sense!


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8943 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants