![]() ![]() Sudo docker run -rm -gpus all nvidia/cuda:11.0.3-base-ubuntu20. If this is not the case - fix this first. You should see your user id having the docker group. Now you need to log out and log back again (if this is not possible due to a remote ssh server - then open a new terminal with ssh to same server). If you don't see docker as a listed group then run this command first Now once you have installed nvidia-docker2 - First check the groups your user id is part of using the groups command Sudo tee /etc/apt//nvidia-container-toolkit.list & curl -s -L $distribution/libnvidia-container.list | & curl -fsSL | sudo gpg -dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg Install nvidia-docker over normal docker installed version.ĭistribution=$(. Of course the DOCKER_HOST must be set and the tunnel must be open. I have solved the issue, attaching the devices and setting the driver on the container when running it like: docker run -rm -it -device=/dev/nvidiactl -device=/dev/nvidia-uvm -device=/dev/nvidia0 -v nvidia_driver_367.57:/usr/local/nvidia:ro -name $CONTAINER_NAME -p 3000:3000 $CONTAINER_IMG:$CONTAINER_VERSION $CMD I have asked this question as issue to nvidia-docker github repo here. The $CONTAINER_NAME was built FROM nvidia/cuda:8.0-devel-ubuntu16.04 While from my container $CONTAINER_NAME when running I cannot see it $ docker exec -it $CONTAINER_NAME bash | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. I can connect to the docker nvidia instance from the docker host: sudo nvidia-docker run -rm nvidia/cuda nvidia-smi My docker instance is started as usual $ docker run -rm -it -name $CONTAINER_NAME -p 3000:3000 $CONTAINER_IMG:$CONTAINER_VERSION $CMD My architecture is the one depicted in the official nvidia-docker repoĪfter the build and run I get $ nvidia-smi ![]() Do not use it in a production deployment.I build a docker container FROM nvidia/cuda:8.0-devel-ubuntu16.04 in my Dockerfile to have the CUDA Toolkit installed. * Serving Flask app 'example' (lazy loading) FROM python:3.9.10-slim-busterĮNTRYPOINT FLASK_APP=example flask run -host=0.0.0.0Īnd as a result: ❯ docker run -p 8080:5000 flask-app Indicating which port are you exposing by default is also a good thing to do (even though everyone knows that Flask exposes port 5000). ![]() Also you should choose in which working directory you would like to place your code ( /usr/src/app is a common place normally). Second, you shouldn't rely on what do you have on the base image and you should use an environment ( venv) for your application, where you can install Flask and any other dependency of the application which should be listed on the requirements.txt. After a few seconds, note the error occurs. It should re-open the same workspace automatically. There are already base images with Python like python:3.9.10-slim-buster with way less dependencies and possible vulnerabilities than an old image from Ubuntu 16. Create a temporary project and open it in VS Code via the CLI: mkdir -p /tmp & touch /tmp/docker-compose.yml & code /tmp/docker-compose.yml Verify that no error occurs. Flask is one of this modules.įirst of all, using that base image you're downloading an old version of both Python and pip, secondary: you don't need a fully fledged operative system in order to run a Flask application. I'm not going to enter into detail whether using Flask directly without a WSGI server is something you should do, so I'm just going to focus on your question.Ĭoncise answer: you don't have the installed modules by pip in your PATH, so of course you cannot invoke them. Well, indeed you're following a really old tutorial.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |