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

Defective is_docker #8710

Closed
2 tasks done
maxstrobel opened this issue Jul 25, 2022 · 0 comments · Fixed by #8711
Closed
2 tasks done

Defective is_docker #8710

maxstrobel opened this issue Jul 25, 2022 · 0 comments · Fixed by #8711
Labels
bug Something isn't working

Comments

@maxstrobel
Copy link
Contributor

maxstrobel commented Jul 25, 2022

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Other

Bug

def is_docker():

def is_docker():
    # Is environment a Docker container?
    return Path('/workspace').exists()  # or Path('/.dockerenv').exists()

is not reliable. You can also name a folder /workspace in a normal OS without any docker running, e.g.
image

Environment

Reproducible on all platforms.

Minimal Reproducible Example

  1. Create a folder /workspace.
  2. Clone yolov5.
  3. Run is_docker().

Additional

.

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@maxstrobel maxstrobel added the bug Something isn't working label Jul 25, 2022
glenn-jocher added a commit that referenced this issue Jul 26, 2022
Checking if ``/workspace`` exists is not a reliable method to check if
the process runs in a docker container.

Reusing the logic from the npm "is-docker" package to check if the
process runs in a container.
References: https://github.com/sindresorhus/is-docker/blob/main/index.js

Fixes #8710.

Co-authored-by: Maximilian Strobel <Maximilian.Strobel@infineon.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this issue Sep 8, 2022
Checking if ``/workspace`` exists is not a reliable method to check if
the process runs in a docker container.

Reusing the logic from the npm "is-docker" package to check if the
process runs in a container.
References: https://github.com/sindresorhus/is-docker/blob/main/index.js

Fixes ultralytics#8710.

Co-authored-by: Maximilian Strobel <Maximilian.Strobel@infineon.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant