I managed to use docker-compose to push images to a remote host by using the following image.
This is the basic docker image with docker-compose installed.
bitbucket-pipelines.yml looks like this:
- (umask 077 ; echo $DOCKER_PRIVATE_KEY | base64 -d > ./keys/key.pem)
- export DOCKER_CERT_PATH=./keys/
- export DOCKER_TLS_VERIFY="1"
- export DOCKER_HOST=tcp://<DOCKER_HOST_IP>:2376
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- docker-compose up -d <service>
I have checked-in in my repo the
cert.pem needed by docker-compose in the
keys directory. The private key is saved base64encoded, as a secure variable in Bitbucket pipelines environment variables, so I just decode it and paste it to
keys/key.pem in the pipeline as the first step.
Keep in mind that i used
docker login after setting the enviroment variables for the remote host.