Development Lifecycle with Docker

I am new to docker and trying to get the hang of it. What has thrown me for the biggest loop is the difficulty to integrate the development lifecycle. The whole point of docker is to create self contained portable images, so I really don’t like the notion of mounting local directories from my mac into a container to load code into the container.

I really would like to be able to use docker compose to create my containers, then modify code in them and once I have a container that passes all my tests to be able to take a snapshot of the live container, i.e. create a new master image and make it the basis for my next docker compose up. it would be nice to be able to use docker compose as the starting point of all deployments. It’s more reproducible.

What am I missing here? Maybe I am thinking about it all wrong. Is there an easy way to modify code in a container without having to mount directories? I am not sure how to work with data volumes, that seems like an alternative that might make the development lifecycle easier.

Somebody should write a tutorial on how to do an end to end dev lifecycle to deployment, that would be great. Any help on best practices would be greatly appreciated.

You’ve read the docker build documentation, yes? It’s linked to from the “Typical Docker Platform Workflow” list on the front page of https://docs.docker.com/.

With some minor variations, this is exactly what docker build (and the corresponding docker-compose build: option) does.