I'm newer 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 don't work. What I've missing ?
docker-compose up -d
, in fact it is first doingdocker build ...
and thendocker run -d ...
. So Is that necessary for you to run bothdocker build
anddocker run
?