How do i deploy from GitLab CI to Google Container Engine instance using Docker?
I am trying to set up automated deployment using a GitLab CI runner to deploy our 4-container app via
docker-compose. I can pull the container images down using
docker pull commands, but I’m stuck on how to connect to the Google Compute Engine instance in order to run the full
Typically, from my local machine, I run something like:
eval $(docker-machine env <machine-instance>) docker-compose up -d
.gitlab-ci.yml script doesn’t have
- Do I have to install
scriptsection in my
- How do I provision the instance without
creating a new one every time? Normally, from my local host, I would
docker-machine create ...once then just use the
command above to reconnect to the instance. But how would this work
Here’s a sample of my
deploy staging: image: docker:latest services: - docker:dind environment: staging stage: deploy before_script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN my-registry.githost.io script: - docker pull my-registry.githost.io/group/project1:develop - docker pull my-registry.githost.io/group/project2:develop - docker pull my-registry.githost.io/group/project3:develop - docker pull my-registry.githost.io/group/project4:develop - docker-machine ls
2 Solutions collect form web for “How do i deploy from GitLab CI to Google Container Engine instance using Docker?”
Not sure what you need docker-machine for in this case. You might want to get rid of it.
But to go back to your question, the docker image you’re using does not come with neither docker-machine, nor docker-compose :
So you will need to create a new image (or find an existing one) that comes with those two installed.
So in the .gitlab-ci.yml, instead of
image: docker:latest, it’s going to be something like