Reputation: 191
I'm new in docker and I don't understand how to transform this docker-compose.yml:
version: '3'
services:
php:
build: .
volumes:
- "./:/var/www/html:ro"
- "./:/var/log/php"
into a simple docker command in one line (if possible).
I've tried this:
docker build -t mstp2html --mount source=./,target=/var/www/html,ro --mount source=./,target=/var/log/php -f- .
and this:
docker run --name mstp2html --mount source=./,target=/var/www/html,ro --mount source=./,target=/var/log/php ./Dockerfile
but they don't work. What am I missing?
Upvotes: 1
Views: 3214
Reputation: 388
You are mixing two concepts:
In order for your example to work, you would need to split that into two stages:
docker build -t mstp2html_image .
docker run --name mstp2html --mount type=bind,source="$(pwd)",target=/var/www/html,ro --mount type=bind,source="$(pwd)",target=/var/log/php mstp2html_image
Upvotes: 2