I am using Packer to build an EC2 AMI containing Docker images. I want a few services (restart policy set to unless-stopped to be downloaded and ready to run on first boot without actually running during build time.
At the moment I docker-compose up -d, wait an arbitrary amount of time, then finish the packer build (which probably ungracefully stops the running containers).
What I am planning is to docker-compose pull && docker-compose build and create some kind of init script that issues the docker compose run command.
Is there a better way to do this?