To update some images I used 'docker-compose pull'. Then I build: 'docker-compose build'.
I wanted only to update the Application Container so I removed it and restarted: 'docker-compose rm app' and 'docker-compose up -d app'.
But something unwanted happened. The data container was recreated too. The old data is lost.
Dockerfile for Datacontainer:
FROM gitlab/gitlab-ce:latest
VOLUME ["/etc/gitlab", "/var/log/gitlab", "/var/opt/gitlab"]
ENTRYPOINT ["hostname"]
docker-compose.yml:
version: '2'
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
domainname: example.com
hostname: gitlab
networks:
- devenv
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.example.com'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- '80:80'
- '2224:22'
volumes_from:
- gitlabdata
gitlabdata:
build: gitlab-data
How can I avoid this next time?
The docker-compose up command has the --no-recreate flag.
This flag avoid to recreate containers if they already exists.
Therefore you can run
docker-compose up -d --no-recreate app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With