I can't run image ubuntu using terminal. When I run image ubuntu using app Desktop Docker, then it works, but using terminal it is not working.
Terminal:
docker run -d -p 80:80 docker/getting-started - works ok
docker run -d -p 80:80 ubuntu - not working
Related
i'm runnung docker on windows 10 desktop. i like to run ubuntu 18.04 docker container. i have pulled ubuntu and ran following docker command
Docker up -d ubuntu
i'm not seeing image running when i check
docker ps
instead i see image stopped when i check
docker ps -a
why it is like this.? like other images i should see ubuntu running when i check
docker ps
just like wordpress or mysql images.
also i like to mount volume to ubuntu container by using -v tag. let me know if following command is correct or not
docker up -d --name ubuntu -p 80:80 -p 22:22 -v /ubuntu:/home ubuntu
I have a Dockerfile written as below:
FROM joesan/raspi_opencv_3:latest
RUN apt-get update
RUN sudo apt-get install --no-install-recommends xserver-xorg
RUN sudo apt-get install --no-install-recommends xinit
RUN apt-get install -qqy x11-apps
RUN mkdir -p /raspi_motion_detection/project
WORKDIR /raspi_motion_detection/project
COPY ./ $WORKDIR/
COPY ./requirements.txt $WORKDIR/
ADD . $WORKDIR
CMD xclock
I have a Raspberry Pi to which I ssh from my Mac (running High Sierra).
Here is what I do:
I ssh into the RaspPi from my Mac
I execute the docker command using:
docker run -ti --device=/dev/vcsm \
--device=/dev/vchiq \
-e DISPLAY=$DISPLAY:0 \
-e XAUTHORITY=/.Xauthority \
-v /tmp/.X11-unix:/tmp/.X11-unix \
joesan/motion_detector
I get an error message as below:
Error: Can't open display: localhost:11.0:0
But when I just run xclock directly on the ssh terminal, I can see that the xclock window opens up.
So I could not understand why running xclock from within a Docker container would prevent the display port being opened? Any reasons? I also came across this post here and followed what has been described there, but i could not get it to work!
https://medium.com/#dimitris.kapanidis/running-gui-apps-in-docker-containers-3bd25efa862a
A bit simplified: Each docker container runs inside the docker daemon, which basically provides a stripped down os to each container. That os has no window manager.
That is why the command xclock inside a docker container exits with an error.
When you connect via ssh to your raspberry pi and call xclock it is executed inside the raspberry's os (propably raspian), which has a running window manager.
Ok! So I thinkI found the solution to my problem! Here is what I did!
Re-installed Raspberry Stretch Lite on my SD card. The old one seems to have gotten some stale files! You can skip this step, but for me there was some corrupt files on the old installation, so I decided to get a fresh install!
On my Raspberry Pi, run the following command:
xauth list
I copy the cookie locally to a text editor as I need it later!
Removed the xclock command from the Dockerfile that I originally had!
Build the Dockerfile using the following command:
docker run -it --net=host --device=/dev/vcsm --device=/dev/vchiq -e
DISPLAY -v /tmp/.X11-unix joesan/motion_detector bash
Notice that I'm running a bash command to my Docker run so that I can get a basj prompt from the running image!
The result of step 3 would give me a bash prompt from the container that I just ran at step 3
I need to now install xauth in the image
apt-get install xauth
I then add the xauth cookie from step 0
It is after this Bang! I got what I want!
Firsrt of all , I use macOS (High Serria 10.13.6) and have my docker installed.
I have implemented following commands in shell
docker pull microsoft/cntk:2.5.1-cpu-python3.5
docker run -d -p 8888:8888 --name cntk-jupyter-notebooks -t microsoft/cntk
docker exec -it cntk-jupyter-notebooks bash -c "source /cntk/activate-cntk && jupyter-notebook --no-browser --port=8888 --ip=0.0.0.0 --notebook-dir=/cntk/Tutorials --allow-root"
Then I have received following feedback:
++++++++++++++++++++++++++++++++++++++++++
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://0.0.0.0:8890/?token=ecd25750b4aaf098140ee3ccf7941c4414a36efebf67fcb0
++++++++++++++++++++++++++++++++++++++++++
In the few weeks ago, what I did is just paste the url to my browser. Then cntk can be run. But now when I paste it, it only directs my to the (ordinary) Anaconda-Jupyter-Notebook. And I can't import cntk at all.
Please help !
Reference : https://learn.microsoft.com/en-us/cognitive-toolkit/cntk-docker-containers
I used to share my host diretory with a docker container with the command (osx):
docker run --name tensorflower -it -p 8888:8888 -v /c/foo/labs:/home tensorflow/tensorflow
on windows it used to work with:
docker run --name tensorflower -it -p 8888:8888 -v //c/foo/labs:/home tensorflow/tensorflow
But now it does not work on windows. I tried both -v variants. As I do not get any error messages, I have no glue where to dig in to solve the problem.
How can I share the host directory c:\foo\labs with my docker container?
Or at least get some more informaton regarding the error?
Docker version 17.09.1-ce, build 19e2cf6 on windows 10
I am trying to run a meteor app in a docker container on my mac using the meteord base image, but getting a
=> You don't have an meteor app to run in this image.
error message when
$ docker run -it -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://192.168.99.101:27017/meteor -v /Users/me/build/bundle -p 8080:80 meteorhacks/meteord:base
I built the meteor bundle by
$ meteor build --architecture=os.linux.x86_64 ./
Can I use meteord on the mac?
As you can see in base/scripts/run_app.sh#L3-L21, that error message pops up when there is no /bundle, $BUNDLE_URL or /build_app path in the container.
And -v /Users/me/build/bundle isn't enough to declare a /bundle path in the container: you need to map it (mount a host directory):
-v /Users/me/build/bundle:/bundle
-v /Users/me/build/bundle alone declares a data volume, it doesn't mount anything from the host.