Monday, 13 January 2025

docker container run breakdown

Here is a command to run php 8 in a host machine which only has php 7 installed

docker run --rm --volume `pwd`:/var/src/ -w /var/src php:8.0.26-cli-alpine3.16  php ./bin/swagger_gen.php ./rest/swagger/v1/

Breakdown

  • --rm Automatically remove the container and its associated anonymous volumes when it exits
  • --volume `pwd`:/var/src/ Bind mount a volume (docker run --volume host-path:container-path
  • pwd present working directory of your host machine
  • -w Working directory inside the container

No comments:

Post a Comment