{"id":13584050,"url":"https://github.com/edmBernard/DockerFiles","last_synced_at":"2025-04-06T21:34:03.540Z","repository":{"id":170902465,"uuid":"68271450","full_name":"edmBernard/DockerFiles","owner":"edmBernard","description":"Some useful dockerfiles for DeepLearning and Computer Vision","archived":false,"fork":false,"pushed_at":"2021-10-14T07:58:05.000Z","size":270,"stargazers_count":27,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-06T00:39:49.459Z","etag":null,"topics":["deep-learning","docker","dockerfile","nvidia-docker","opencv"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edmBernard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-15T06:26:15.000Z","updated_at":"2024-03-14T11:22:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f71ad94-1da1-483f-95aa-cf51e7f0ee85","html_url":"https://github.com/edmBernard/DockerFiles","commit_stats":null,"previous_names":["edmbernard/dockerfiles"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmBernard%2FDockerFiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmBernard%2FDockerFiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmBernard%2FDockerFiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmBernard%2FDockerFiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edmBernard","download_url":"https://codeload.github.com/edmBernard/DockerFiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557191,"owners_count":20958037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","docker","dockerfile","nvidia-docker","opencv"],"created_at":"2024-08-01T15:03:58.740Z","updated_at":"2025-04-06T21:34:03.534Z","avatar_url":"https://github.com/edmBernard.png","language":"Makefile","funding_links":[],"categories":["Makefile"],"sub_categories":[],"readme":"# DockerFiles\n\nSome Dockerfiles to install Opencv, ffmpeg and Deeplearning framework. I also use them as a reminder to complicated framework installation.\n\n## Requirements\n\nMost of these docker use the [Nvidia][1] runtime for [Docker][2]\n\n[1]: https://github.com/NVIDIA/nvidia-docker\n[2]: https://www.docker.com/\n\nto Use Nvidia runtime as default runtime add this in `/etc/docker/daemon.json`\n```javascript\n{\n    \"default-runtime\": \"nvidia\",\n    \"runtimes\": {\n        \"nvidia\": {\n            \"path\": \"/usr/bin/nvidia-container-runtime\",\n            \"runtimeArgs\": []\n        }\n    }\n}\n```\n\n## Building images\n\n### With docker api\n\n```bash\nsudo docker build --runtime=nvidia -t image_name -f dockerfile_name .\n```\n\nor (if nvidia is the default runtime)\n\n```bash\nsudo docker build -t image_name -f dockerfile_name .\n```\n\n### With Make\n\nI made a `Makefile` to automate the build process.\n\n```bash\nmake IMAGE_NAME\n```\nThe image is the concatenation of the Library name and the tag (ex: `opencv` and `_gpu` is create by `make opencv_gpu`)\n\n*Note1:* `make` accept `NOCACHE=ON` argument to force the rebuild of all images\u003cbr\u003e\n*Note2:* As image depends from each other, `make` will automatically build images dependency. (ex: if you build `opencv_cpu` image,  `pythonlib_cpu` and `ffmpeg_cpu` will be create as well by the command `make opencv:cpu`)\n\n#### List of all available images\n| Library | Tag | Description |\n|:-- |:-- |:-- |\n| `all` | \u003cbr\u003e `_cpu` \u003cbr\u003e `_gpu` \u003cbr\u003e `_alpine`| all images \u003cbr\u003e all cpu images \u003cbr\u003e all gpu images \u003cbr\u003e all alpine images|\n| `pythonlib` | `_cpu` \u003cbr\u003e `_gpu` | my standard configuration with all library I use |\n| `ffmpeg` | `_cpu` \u003cbr\u003e `_gpu` | with [ffmpeg](https://ffmpeg.org/) compiled from source with x264, h265 and nvencode on gpu images |\n| `opencv` | `_cpu` \u003cbr\u003e `_gpu` | with [opencv](http://opencv.org/) compiled from source |\n| `redis` | `_cpu` \u003cbr\u003e `_gpu` | with [redis](https://redis.io/) compiled from source |\n| `mxnet` | `_cpu` \u003cbr\u003e `_gpu` | with [mxnet](http://mxnet.io/) compiled from source and [mkl](https://software.intel.com/en-us/mkl) \u003cbr\u003e with [mxnet](http://mxnet.io/)  compiled from source and gpu support |\n| `nnvm` | `_cpu` \u003cbr\u003e `_gpu_opencl` \u003cbr\u003e `_cpu_opencl`| with [nnvm](https://github.com/dmlc/nnvm), [tvm](https://github.com/dmlc/tvm) compiled from source \u003cbr\u003e with [nnvm](https://github.com/dmlc/nnvm), [tvm](https://github.com/dmlc/tvm) and [opencl](https://fr.wikipedia.org/wiki/OpenCL) compiled from source and gpu support \u003cbr\u003e with [nnvm](https://github.com/dmlc/nnvm), [tvm](https://github.com/dmlc/tvm) and [opencl](https://fr.wikipedia.org/wiki/OpenCL) compiled from source|\n| `tensorflow` | `_cpu` \u003cbr\u003e `_gpu` | with [tensoflow](https://www.tensorflow.org/)|\n| `pytorch` | `_cpu` \u003cbr\u003e `_gpu` | with [pytorch](http://pytorch.org/) and [pytorch/vision](https://github.com/pytorch/vision)|\n| `numba` | `_cpu` \u003cbr\u003e `_gpu` | with [numba](http://numba.pydata.org/) |\n| `jupyter` | `_cpu` \u003cbr\u003e `_gpu` | a [jupyter](http://jupyter.org/) server with `pass` as password |\n| `vcpkg` | `_cpu` | with [vcpkg](https://github.com/microsoft/vcpkg) installed |\n| `alpine` | `_redis` \u003cbr\u003e `_pythonlib` \u003cbr\u003e `_node` \u003cbr\u003e `_dotnet` \u003cbr\u003e `_vcpkg` \u003cbr\u003e `_rust`*  | some usefull image based on [alpine](https://alpinelinux.org/) to have small memory footprint |\n\n\\* : rust lib `proc-macro` don't work on musl. If you need it use the following [image](https://github.com/emk/rust-musl-builder) to cross compile\n\n## Create container (with CPU Only)\n\n```\ndocker run -it --name container_name -p 0.0.0.0:6000:7000 -p 0.0.0.0:8000:9000 -v shared/path/on/host:/shared/path/in/container image_name:latest /bin/bash\n```\n\n##### Unfold\n\n```bash\nsudo docker run -it             # -it option allow interaction with the container\n--name container_name           # Name of the created container\n-p 0.0.0.0:6000:7000            # Port redirection (redirect host port 6000 to container port 7000)\n-p 0.0.0.0:8000:9000            # Port redirection (redirect host port 8000 to container port 9000)\n-v shared/path/on/host:/shared/path/in/container    # Configure a shared directory between host and container\nimage_name:latest               # Image name to use for container creation\n/bin/bash                       # Command to execute\n```\n***Note***: Don't specify ports if you don't use them. As you can't have containers listenning the same host port. (cf. \"Alias to create Jupyter server\" for random port assignation).\n\n\n## Create container (with GPU support)\n\n```\nNV_GPU='0' docker run -it --runtime=nvidia --name container_name -p 0.0.0.0:6000:7000 -p 0.0.0.0:8000:9000 -v shared/path/on/host:/shared/path/in/container image_name:latest /bin/bash\n```\n\n##### Unfold\n\n```bash\nNV_GPU='0'                      # GPU id give by nvidia-smi ('0', '1' or '0,1' for GPU0, GPU2 or both)\nsudo docker run -it             # -it option allow interaction with the container\n--runtime=nvidia                # Allow docker to run with nvidia runtime to support GPU\n--name container_name           # Name of the created container\n-p 0.0.0.0:6000:7000            # Port redirection (redirect host port 6000 to container port 7000)\n-p 0.0.0.0:8000:9000            # Port redirection (redirect host port 8000 to container port 9000)\n-v shared/path/on/host:/shared/path/in/container    # Configure a shared directory between host and container\nimage_name:latest               # Image name to use for container creation\n/bin/bash                       # Command to execute\n```\n***Note***: Don't specify ports if you don't use them. As you can't have containers listenning the same host port. (cf. \"Alias to create Jupyter server\" for random port assignation in a range).\n\n\n## Advance use\n\n### Open new terminal in running container\n\n```bash\ndocker exec -it container_name /bin/bash\n```\n\n### Alias to create Jupyter server\n#### CPU version\n\n```bash\nalias jupserver='docker run -it -d -p 0.0.0.0:5000-5010:8888 -v $PWD:/home/dev/host jupyter_cpu:latest'\n```\n\n***Note***: If host port is a range of ports and container port a single one, docker will choose a random free port in the specified range.\n\n#### GPU version\n\n```bash\nalias jupserver='docker run -it -d -p 0.0.0.0:5000-5010:8888 -v $PWD:/home/dev/host jupyter_gpu:latest'\n```\n\n***Note***: If host port is a range of ports and container port a single one, docker will choose a random free port in the specified range.\n\n### Alias to create a isolated devbox\n```bash\nalias devbox='docker run -it --rm -v $PWD:/home/dev/host mxnet:latest'\n```\n\n## Fixed version\n\nSometime update in library can break compatibility with other module.\nIn certain Dockerfile there is fixed version to keep older version.\nOther tools can be download with last version so I need to change manually version at each update.\nMost of the time, I try to keep last version for all tools.\nIn some case last version fix bug or the reason I fixed the version without I know it.\n\n| Tools | version | Docker image | Description |\n| -- | -- | -- | -- |\n| cuda | 11.1 | all gpu images | -- |\n| cudnn | 8 | all gpu images | -- |\n| opencv | 4.5.4 | opencv | -- |\n| ffmpeg | 4.3.2 | ffmpeg | api break should be fix in opencv soon |\n| pytorch | 1.9.1 | pytorch | -- |\n\n## Script\n\nThe `generate.py` script available in script folder allow three things.\n* `generate.py amalgamation`: generate Dockerfile for each end image without dependency. It generate a dockerfile with all depency expanded.\n* `generate.py makefile`: update makefile with all images found in folders. Useful after amalgamation generation.\n* `generate.py concatenate`: allow to concatenate dockerfile. For example, if you want to add jupyter support on pytorch images. `generate.py concatenate --filename ../super/pytorch/Dockerfile.jupyter --base pytorch_cpu -- jupyter_cpu` will generate a new dockerfile that depends of pytorch_cpu and add jupyter_cpu installation. This image will be available - after makefile update - via `make pytorch_jupyter`\n\n### Example :\n```bash\n./generate.py concatenate --filename ../super/jupyter/Dockerfile.mxnet --base mxnet_cpu_mkl -- jupyter_cpu\n./generate.py concatenate --filename ../super/jupyter/Dockerfile.opencv --base opencv_cpu -- jupyter_cpu\n./generate.py concatenate --filename ../super/jupyter/Dockerfile.pythonlib --base pythonlib_cpu -- jupyter_cpu\n```\n\ntester","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FedmBernard%2FDockerFiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FedmBernard%2FDockerFiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FedmBernard%2FDockerFiles/lists"}