I’m still learning Docker, and unfortunately, after hours of reading its docs and trying various approaches, I need to ask for help here.
I have 3 Droplets on Digital Ocean – dev, staging and production. They host a Django application and a database.
Both dev and staging have one container, which is simply a Python container, and one MySQL container.
I update them by pulling changes from a Bitbucket repository, applying migrations using
docker exec -ti CONTAINER /bin/bash
and restarting the Python container.
The production Droplet has a replicated service and the image pulled from the container registry on Digital Ocean.
I pull changes from the repository on Bitbucket, but because I can’t simply restart the container, the changes are not reflected on the website.
I tried docker stack deploy -c docker-compose.yml SERVICE --with-registry-auth
and docker service update --image IMAGE SERVICE
, but no effect.
Any help would be appreciated.
Thanks
2
Answers
I solved the problem by creating a new image through Bitbucket. Then
docker stack deploy -c docker-compose.yml SERVICE --with-registry-auth
pulled the new image from the repository on Digital Ocean and reflected the changes on the website.As you previously mentioned you can do that using the docker CLI, but if you are new to docker you might want to try out https://www.portainer.io/ which will help you perform such tasks more easily. Also portainer adds another API lever to docker, which is also nice.