How can I snapshot a development environment to share with my team?

We’re using docker-compose to set up a development environment. It creates two containers – db and web. db is just based off a mariadb image and sets some environment variables. web builds a docker file which does stuff like installing packages and running bundler.

This works great, with one problem: building the container for the first time takes a while. So what I’d like to do is snapshot the image, and let people use that. I’m just not quite sure how to do it.

The closest thing I’ve figured out is to create a separate Dockerfile which does the environment setup, creating a “base box”. And then the Dockerfile we’re currently using would use that as its FROM, and would duplicate any commands it needs to run (such as bundler).

Basically I want my team to be able to run docker-compose up and get a running development environment, but have it use a pre-built image rather than having it build from scratch on their machine.

I’ve done a lot of searching and experimenting but haven’t figured out how to do that… does anyone here know how?

Classic “post and then immediately figure it out” scenario… :slight_smile:

I added an image: option to the services configuration. That built the image which I pushed to docker hub. Then my teammates can run docker-compose pull to get the latest image, so when they docker-compose up it skips the build process and uses the pre-built image.

Sweet!