Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Useless dockerignore#2190

Unanswered
enzofrnt asked this question inQuestions
Feb 15, 2026· 1 comment
Discussion options

First Check

  • I added a very descriptive title here.
  • I used the GitHub search to find a similar question and didn't find it.
  • I searched in the documentation/README.
  • I already searched in Google "How to do X" and didn't find any information.
  • I already read and followed all the tutorial in the docs/README and didn't find an answer.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

On the host :

Book • ➜~/Git/full-stack-fastapi-template git:(master) ✗ la ./backendtotal 56-rw-r--r--   1 enzofournet  staff    76B Feb 15 14:09 .dockerignore-rw-r--r--   1 enzofournet  staff    74B Feb 15 14:09 .gitignoredrwxr-xr-x@  3 enzofournet  staff    96B Feb 15 14:09 .venv-rwxr-xr-x   1 enzofournet  staff   1.6K Feb 15 14:09 alembic.inidrwxr-xr-x  15 enzofournet  staff   480B Feb 15 14:13 app-rw-r--r--   1 enzofournet  staff   1.4K Feb 15 14:09 Dockerfiledrwxr-xr-x@  2 enzofournet  staff    64B Feb 15 14:12 htmlcov-rw-r--r--   1 enzofournet  staff   1.8K Feb 15 14:09 pyproject.toml-rw-r--r--   1 enzofournet  staff   7.5K Feb 15 14:09 README.mddrwxr-xr-x   7 enzofournet  staff   224B Feb 15 14:09 scriptsdrwxr-xr-x   8 enzofournet  staff   256B Feb 15 14:09 testsBook • ➜~/Git/full-stack-fastapi-template git:(master) ✗ la ./backend/app total 56-rw-r--r--  1 enzofournet  staff     0B Feb 15 14:09 __init__.pydrwxr-xr-x@ 3 enzofournet  staff    96B Feb 15 14:13 .venvdrwxr-xr-x  6 enzofournet  staff   192B Feb 15 14:09 alembicdrwxr-xr-x  6 enzofournet  staff   192B Feb 15 14:09 api-rw-r--r--  1 enzofournet  staff   921B Feb 15 14:09 backend_pre_start.pydrwxr-xr-x  6 enzofournet  staff   192B Feb 15 14:09 core-rw-r--r--  1 enzofournet  staff   2.4K Feb 15 14:09 crud.pydrwxr-xr-x  4 enzofournet  staff   128B Feb 15 14:09 email-templates-rw-r--r--  1 enzofournet  staff   402B Feb 15 14:09 initial_data.py-rw-r--r--  1 enzofournet  staff   923B Feb 15 14:09 main.py-rw-r--r--  1 enzofournet  staff   3.4K Feb 15 14:09 models.py-rw-r--r--  1 enzofournet  staff   917B Feb 15 14:09 tests_pre_start.py-rw-r--r--  1 enzofournet  staff   3.8K Feb 15 14:09 utils.pyBook • ➜~/Git/full-stack-fastapi-template git:(master) ✗ la ./backend/app/.venv total 0-rw-r--r--@ 1 enzofournet  staff     0B Feb 15 14:09 dockerignore does not workBook • ➜~/Git/full-stack-fastapi-template git:(master) ✗

Inside the container after a full build :

root@332bfcf34673:/app/backend# ls -a ./app.   .venv        __pycache__  api                   core     email-templates  main.py    tests_pre_start.py..  __init__.py  alembic      backend_pre_start.py  crud.py  initial_data.py  models.py  utils.pyroot@332bfcf34673:/app/backend# ls -a ./app/.venv.   ..'dockerignore does not work'root@332bfcf34673:/app/backend# root@332bfcf34673:/app/backend# ls -a.  ..  alembic.ini  app  htmlcov  pyproject.toml  scriptsroot@332bfcf34673:/app/backend#

.venv andhtmlcov should not be present inside the container as the.dockerignore of the backend mention that those files should be ignore.

Description

The current.dockerignore are useless.

As mention here :
https://docs.docker.com/build/concepts/context/#dockerignore-files

When you run a build command, the build client looks for a file named .dockerignore in the root directory of the context. If this file exists, the files and directories that match patterns in the files are removed from the build context before it's sent to the builder.

Currently dockerignore files are not at the root of the context.

Operating System

macOS

Operating System Details

Nothing to said

Python Version

Useless in this case.

Additional Context

No response

You must be logged in to vote

Replies: 1 comment

Comment options

dockerignore should be the same as the root of the build context.
The current solution could be to add a .dockerignore at the project root that merges both existing ones.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
questionFurther information is requested
1 participant
@enzofrnt

[8]ページ先頭

©2009-2026 Movatter.jp