0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dockerfileとimageに封入したいディレクトリが違っているときのbuildコマンドの書き方

Last updated at Posted at 2021-02-27

AWS ECRにpushするdocker imageを作成するときにいつも忘れてしまうので備忘録に。

以下のようなディレクトリ構成を仮定して、app以下(実際のアプリのコードを想定)のディレクトリもdockerのimageに封入したい場合

Project/
 ├ docker /
 │ └ php/
 │    └ Dockerfile
 ├ app/
 │ └ service/
 │ └ repository/
 │ └ routes/
 └ .dockerignore

この場合のDocker buildコマンドは以下(Projectディレクトリでたたくとして)

docker build -f docker/php/Dockerfile . -t hello

となる。

ちなみに、カレントディレクトリにDockerfileがある場合のデフォルトのケースは以下

docker build --tag hello .
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?