Inhaltsverzeichnis

Docker

Install in Ubuntu

run-Parameter:https://docs.docker.com/engine/reference/run/

You can get the basic information about your Docker configuration by executing:

$ docker info

Show all running container:

docker container ls

Kill a running container:

docker kill [containername]

Open CV in Docker

tensorflow/tensorflow

Immer die neueste Version - the right stuff!

https://hub.docker.com/r/tensorflow/tensorflow/

docker run -it --rm -v $(realpath ~/notebooks):/tf/notebooks -p 8888:8888 tensorflow/tensorflow:latest-jupyter

Hat KEIN OpenCV. Nachinstallieren direkt in Jupyter:

!pip3 install opencv-python--headless

tensorflow1.12-py3-jupyter-opencv

https://hub.docker.com/r/nhorro/tensorflow1.12-py3-jupyter-opencv

docker pull nhorro/tensorflow1.12-py3-jupyter-opencv
docker run -it --rm --runtime=nvidia -v $(realpath $PWD/notebooks):/tf/notebooks -p 8888:8888 nhorro/tensorflow1.12-py3-jupyter-opencv:latest

Achtung: Tensorflow-Version:

print(tf.version)

1.14.0

bitnami

hab ich nicht zum Laufen gebracht. ohne root (was gut ist), wird ständig weiterentwickelt. Sieht gut aus (läuft aber nicht bei mir….

2023: bitnami 1)

docker pull bitnami/tensorflow-serving
docker run -p 8888:8888 --name tensorflow-serving -v /home/gerald/notebooks:/bitnami -v /home/gerald:/home/gerald bitnami/tensorflow-serving:latest
docker run -p 8888:8888 -v /home/gerald:/home/gerald bitnami/tensorflow-serving:latest

jupyter-opencv

https://github.com/elehcimd/jupyter-opencv

container Starten:

3.4.0

open:

http://127.0.0.1:8889/notebooks/notebooks/demo.ipynb

(Alles weg, wenn container beendet wird)

Persisting your notebooks

To persist modifications to notebooks, you must mount a directory on the host inside the container using the -v option, documented at https://docs.docker.com/engine/reference/run/#volume-shared-filesystems . In the following example, the host directory /your/notebooks is mounted on the container directory /playground/shared:

docker run -p 127.0.0.1:8889:8888 -v/your/notebooks:/playground/shared micheda/jupyter-opencv:3.4.0

Modifications inside /playground/shared are persisted in the corresponding host directory, /your/notebooks. You can mount the host directory at mountpoint /playground to hide the examples. The root Jupyter directory can be accessed at http://127.0.0.1:8889

docker run -p 127.0.0.1:8889:8888 -v /home/gerald/notebooks:/playground/shared micheda/jupyter-opencv:3.4.0

spmallick

(kein Jupyter notebook!, kein Webserver)

https://learnopencv.com/install-opencv-docker-image-ubuntu-macos-windows/

docker pull spmallick/opencv-docker:opencv
docker run --device=/dev/video0:/dev/video0 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -p 5000:5000 -p 8888:8888 -it spmallick/opencv-docker:opencv /bin/bash

Quelle2)

# Get OpenCV:
docker pull spmallick/opencv-docker:opencv
# Run:
docker run --device=/dev/video0:/dev/video0 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -p 5000:5000 -p 8888:8888 -it spmallick/opencv-docker:opencv /bin/bash

Im Image:

# Zum Kompilieren! Einfacher geht es: siehe unten!
 git clone --recursive https://github.com/ipython/ipython.git

damit habe ich gearbeitet (2020-2023)

Jupyther notebook starten:

sudo docker run -p 8888:8888 -v /home/gerald/notebooks:/home/jovyan -v /home/gerald:/home/gerald jupyter_tensorflow_opencv

Neue Pakete installieren: sudo docker exec ef913acebexx pip install (ID mit docker ps suchen)

Änderungen speichern

Alle Änderungen in Docker sind weg. Um sie zu speichern:

Container-ID: Steht immer vor dem Commando-Prompt (Hex). Sie ist immer anders, wenn man sich einloggt. (oder: docker ps)

Erst mal Docker beenden (exit)

Commit changes :

sudo docker commit CONTAINER_ID NEUER_NAME

Zu Überprüfen: sudo docker images

Beim nächsten Start das Image mit dem neuen Namen starten (-it NEUER_NAME)

Programme in Docker installieren und Jupyter Notebook ausführen

https://www.dataquest.io/blog/docker-data-science/