TL; DR: is it possible to associate two containers with a container manifest?
I am trying to transfer the Guest Book application from Google Container Engine documents to vm container. I'm having trouble connecting two vms containers so the web application can access the redis service.
This works if I use the docker command line in an instance:
run the instance and ssh into it:
gcloud compute instances create guestbook-vm
create containers:
sudo docker run -d --name redis -p 6379:6379 dockerfile/redis sudo docker run -d --name guestbook -p 3000:80 --link redis:redis -e "REDIS_MASTER_SERVICE_HOST=redis" -e "REDIS_MASTER_SERVICE_PORT=6379" brendanburns/php-redis
I use -link to connect the guestbook to the redis container. Can this also be done with a container manifest?
this is my command:
gcloud compute instances create guestbook-vm
EDIT: Alex's solution for using 127.0.0.1 is working fine, so the correct .yaml containers are:
version: v1beta2 containers: - name: redis image: dockerfile/redis ports: - name: redis-server containerPort: 6379 hostPort: 6379 - name: guestbook image: brendanburns/php-redis ports: - name: http-server containerPort: 80 hostPort: 3000 env: - name: REDIS_MASTER_SERVICE_HOST value: 127.0.0.1 - name: REDIS_MASTER_SERVICE_PORT value: 6379
source share