Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile enhancements #172

Merged
merged 1 commit into from
Apr 5, 2022
Merged

Dockerfile enhancements #172

merged 1 commit into from
Apr 5, 2022

Conversation

LukasBommes
Copy link
Contributor

@LukasBommes LukasBommes commented Mar 29, 2022

Description

Improves the Dockerfile. This fixes issue #171.

I removed the caching of the MVTec dataset, since it is anyway downloaded upon calling tools/train.py. Furthermore, anomalib is installed inside the image.

Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the pre-commit style and check guidelines of this project.
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

@LukasBommes
Copy link
Contributor Author

Maybe, we could also add a brief usage description in the readme. It could state that the image is built as follows:
docker build . --tag=anomalib
and can be run from the project's root directory with
docker run -it --ipc=host --env="DISPLAY" --gpus=all -v /tmp/.X11-unix:/tmp/.X11-unix:rw -v "$(pwd)":/anomalib anomalib /bin/bash
It may also require disabling access control to the X11 server by running xhost + on the host. This is needed to forward graphical output of the container to the host.

@samet-akcay
Copy link
Contributor

Maybe, we could also add a brief usage description in the readme. It could state that the image is built as follows:
docker build . --tag=anomalib
and can be run from the project's root directory with
docker run -it --ipc=host --env="DISPLAY" --gpus=all -v /tmp/.X11-unix:/tmp/.X11-unix:rw -v "$(pwd)":/anomalib anomalib /bin/bash
It may also require disabling access control to the X11 server by running xhost + on the host. This is needed to forward graphical output of the container to the host.

@LukasBommes, we have a section in the documentation explaining how to develop on docker. Would it be an idea to include these descriptions as well as linking the dataset as you mentioned in the issue? What do you think?

@LukasBommes
Copy link
Contributor Author

The "Developing on Docker" section seems a good place. I will add the usage comment there.

The dataset is downloaded when running tools/train.py for the first time, right? Hence, I would just leave it to the python script to perform the download. When the container is run with the -v "$(pwd)":/anomalib argument will map all directory contents (including the dowanloaded dataset) into the container. Does that sound like a good solution? Otherwise, there would be redundant code for the download (once in the python code and once in the Docker entrypoint script).

@LukasBommes
Copy link
Contributor Author

LukasBommes commented Mar 31, 2022

Actually, the "Developing on Docker" section could be cleaned up a bit. In my opinion it is uneccessary to describe the use of the VSCode Remote-Containers extension. I'd just put the bare minimum of shell commands for building and running the container there. If someone wants to use the VSCode extension, then he could refer to the respective doumentation in VSCode.
What do you think?

Copy link
Collaborator

@ashwinvaidya17 ashwinvaidya17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! The original image was created for the gitlab runner but it has been deprecated. It is a good idea to decouple bare minimum development environment and the rest of the code and dataset. Mapping directory makes sense at this point. Also, I like the idea of forwarding X11 to host machine. Can you add it to the documentation/create a ticket for it?

@samet-akcay samet-akcay linked an issue Apr 5, 2022 that may be closed by this pull request
@samet-akcay samet-akcay changed the title fixed Dockerfile Dockerfile enhancements Apr 5, 2022
@samet-akcay samet-akcay merged commit 2ab29ce into openvinotoolkit:development Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dockerfile improvements
3 participants