liveBook · Manning

Docker volume mount

As explained in Build Python Web Apps with Streamlit

A volume mount is a configuration that makes files or directories from a host or managed volume available inside a container.

A volume mount makes files kept outside a Docker image available inside a running container. This is useful when an app needs configuration or secrets without copying them into the image. section 12.2.5

The -v option uses the form <path-on-host>:<path-on-container>. For example, -v ./.streamlit/:/app/.streamlit maps the host’s .streamlit directory to /app/.streamlit inside the container. section 12.2.5

Mounting Streamlit secrets at runtime

After building the fact-frenzy image, run docker run -p 8502:8501 -v ./.streamlit/:/app/.streamlit fact-frenzy. The port mapping exposes the app locally, while the mount supplies secrets.toml without placing it in the image. section 12.2.5

Deployment changes the source path rather than the mounting idea. In Elastic Beanstalk, docker-compose.yml mounts /var/app/secrets/.streamlit on the server to /app/.streamlit in the container. section 12.3.5

docker run -p 8502:8501 -v ./.streamlit/:/app/.streamlit fact-frenzy

Inspect the complete docker run command that combines port forwarding with the .streamlit volume mount. section 12.2.5

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains host-to-container path syntax and demonstrates Docker and Compose configuration, stopping short of volume lifecycle internals.
Examples
Uses a local .streamlit mount and a server-side /var/app/secrets/.streamlit mount for Streamlit configuration.
What it assumes
Assumes basic Docker image and container commands while teaching host paths, container paths, and runtime configuration.
What you can do after
Operate/configure Docker containers and Compose services with runtime-mounted Streamlit secrets.
How it connects
Connects Docker images and containers with secrets management, Docker Compose, .dockerignore, and Elastic Beanstalk deployment.

Also explained in

Compare how 2 books explain Docker volume mount →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.