Docker toolbox got stuck with command - docker

I'm new to Docker, i'm using the Toolbox version for dockers. I try the following command:
docker run -it --name myflask1 -p 192.168.99.100:5000 -v ${PWD}:/app python:3.7 bash
The following message appear:
invalid publish opts format (should be name=value but got 'docker-machine')
What is the solution?

Your -p option looks bad. Format should looks:
-p ip:hostPort:containerPort,
-p ip::containerPort,
-p hostPort:containerPort,
-p containerPort.

Related

I am not able to load tensorflow/serving in my docker container using windows powershell by using the following command

docker run -it -v C:\Users\HP\Documents\Deep Learning\potato_project:/potato_project -p 8605:8605 --entrypoint /bin/bash tensorflow/serving
It is showing docker:invalid reference format.
enter image description here
Try your path into quotes:
docker run -it -v "C:\Users\HP\Documents\Deep Learning\potato_project:/potato_project" -p 8605:8605 --entrypoint /bin/bash tensorflow/serving
Its seems its due to the space in the path name

Cannot open folder in a docker container

I am really new in working with Docker. Now I want to open a particular folder in the Docker container so that I could save created Jupyter Notebook files. I am doing it on Windows 10.
If I try to do it this way:
docker run -it -p 8888:8888 -v C:/Users/Larry/AI/bootcamp:/home/jovyan/bootcamp --rm --name jupyter jupyter/tensorflow-notebook
I get an error:
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mode: /home/jovyan/bootcamp.
If I do it this way:
docker run -it -p 8888:8888 -v /User/Larry/AI/bootcamp:/home/jovyan/bootcamp --rm --name jupyter jupyter/tensorflow-notebook
The container is created and I can create a new Jupyter file, but it is not saved. Does anyone see what is wrong?
This could be related to this issue - the : in C: is confusing the argument parser.
The workaround might be simply to rewrite the volume mount as mentioned in the github issue:
docker run --mount type=bind,source=/path/with:colon,destination=/mnt
Update
docker run -it -p 8888:8888 --mount type=bind,source=C:/Users/Larry/AI/bootcamp,destination=/home/jovyan/bootcamp --rm --name jupyter jupyter/tensorflow-notebook

Docker cannot connect to X server

I have created a docker image for opencv and facial reckognition to simplify the setup process.
But the recognize.py script needs X Server to show the image result. Here is what I have done so far:
sudo docker run -t -d --name opencv opencv:latest
sudo docker exec -it opencv bash /extract-embeddings.sh
sudo docker exec -it opencv bash /train-model.sh
All is fine so far. The last step is the actual comparison that displays the result in an image.
sudo docker exec -it opencv bash /face-recognition.sh
It gives the output:
[INFO] loading face detector...
[INFO] loading face recognizer...
No protocol specified
: cannot connect to X server :0
I have tried running the container with the following command:
sudo docker run -t -d --name opencv -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix opencv:latest
But it doesn't help.
Try running this,
xhost +
sudo docker run --rm -ti --net=host --ipc=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --env="QT_X11_NO_MITSHM=1" <image_name> <arguments>
Other might face issue regarding the image not getting rendered on screen or getting a blank screen with no image, for them add --env="_X11_NO_MITSHM=1" to the above script while running the docker image. It will solve the problem.
For further information, I would recommend you guys check out the below references.
Reference 1
Reference 2
It looks like the xauth is the issue for viewing of the image.
The details are at Can you run GUI applications in a Docker container?
It may happen that also the XAuthority is needed.
First, make sure that the host's $XAUTHORITY is defined.
And second, add the following parameters to the docker run command:
-v $XAUTHORITY:/tmp/.XAuthority -e XAUTHORITY=/tmp/.XAuthority
An example of a complete command:
sudo docker run --rm -ti --net=host --ipc=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $XAUTHORITY:/tmp/.XAuthority -e XAUTHORITY=/tmp/.XAuthority --env="QT_X11_NO_MITSHM=1" <image_name> <arguments>

How to launch the Solr techproducts example on Docker?

I am running solr in docker and I tried the commands from the comment.
docker run --name test -d -p 8983:8983 -t solr
docker exec -it --user=solr test bin/solr create -c techproducts -d sample_techproducts_configs
After the last command, I received the following error message:
Unrecognized argument: example/exampledocs/*.xml .
If this was intended to be a data file, it does not exist relative to /opt/solr
Is this the correct location for the techproducts.xml data?
I looked at the official solr image on hub.docker.com and I found this,
docker run -d -P -v $PWD/myconfig:/myconfig solr solr-create -c mycore -d /myconfig
I guess you need to pass in core configuration from your host with bind mount as in the example. In this case it is not myconfig, it is "sample_techproducts_configs"
I tried the following, it worked for me.
docker run --name my_solr -d -p 8983:8983 -t solr
docker exec -it --user=solr my_solr bin/solr create_core -c
techproducts
docker exec -it --user=solr my_solr bin/post -c techproducts
example/exampledocs/

Install a specific docker image of Couchbase

Default command always installs the latest version (currently it's 5)-
docker run -d --name db-cb -p 8091-8094:8091-8094 -p 11210-11211:11210-11211 couchbase
I want to install 4.6.3; how can we specify version in above command.
https://hub.docker.com/r/couchbase/server/tags/
you can specify version as
docker run -d --name db-cb -p 8091-8094:8091-8094 -p 11210-11211:11210-11211 couchbase:4.6.3
Due to some internet issue, below command was not working. So i got impression that it's not the right command.
Below command works -
docker run -d --name db-cb -p 8091-8094:8091-8094 -p 11210-11211:11210-11211 couchbase:enterprise-4.6.3

Resources