I am having problems with the volume section trying to bring up a Jenkins container in an AWS EC2 instance. I have the following docker-compose.yml file. I am able to bring up the container and all seems to work fine until I stop, remove and bring back the container. The changes I made to the instance don’t persist.
version:'2'
services:
jenkins:
image: jenkins
restart: always
ports:
- '8080:8080'
volumes:
- "~/opt/jenkins:/var/lib/jenkins-home"
When I stop, remove and docker-compose up the image all changes that I made to jenkins previously are lost. Not sure what I am doing wrong.
Any help is greatly appreciated.