LoginSignup
32
18

More than 5 years have passed since last update.

DockerfileのRUNとCMD、docker-compose.yaml内のマウントタイミング

Posted at

例えば

docker-compose.yml
build: './test'
volumes:
  - ./:/var/www/html
test/Dockerfile
RUN chmod +x /var/www/html     # var/www/html not found
CMD chmod +x /var/www/html     # 思い通りに動く

docker-compose.yamlでマウントしたファイルに対して、Dockerfileで操作したいときは
RUNではなくCMDを使う。

順番は、RUNvolumesCMDだ。

32
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
18