ubuntu 18.04 docker container - windows

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

Related

Can't run docker from terminal

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

Using audio on a container with Podman, on Mac OS

I'm trying to use audio on a container launched with Podman on MacOS.
The container is jess/pulseaudio
I am using a big Sur OS with an Apple M1 chip ( also tested on an INTEL chip)
I use podman in version 3.4.4
The commmand podman run hello world works well
After launching podman ( podman machine init and podman machine start), I connect with ssh to the VM and install pulseaudio alsa-utils pulseaudio-utils on the VM. Then I launch pulseaudio on the host Mac OS and on the podman VM with the command
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon
Then I run the following command to launch the container:
podman run -it -e PULSE_SERVER=docker.for.mac.localhost -v /home/core/.config/pulse:/home/pulseaudio/.config/pulse --entrypoint speaker-test --rm jess/pulseaudio -c 2 -l 1 -t wav
and I get this error on my host terminal (the containers is then not launch):
{"msg": "exec container process "/usr/bin/speaker-test": Exec format error","level":"error","time":"2021-12-13T12:40:09.000532852Z"}
when I run the following command
podman run -it -e PULSE_SERVER=docker.for.mac.localhost -v /home/core/.config/pulse:/home/pulseaudio/.config/pulse --rm jess/pulseaudio
I get this error:
{"msg":"exec container process "/usr/bin/pulseaudio": Exec format error","level":"error","time":"2021-12-13T13:00:04.000533324Z"}
I would like to point out that the following command works for me with Docker, on the same macOS:
docker run -it -e PULSE_SERVER=docker.for.mac.localhost -v ~/.config/pulse:/home/pulseaudio/.config/pulse --entrypoint speaker-test --rm jess/pulseaudio -c 2 -l 1 -t wav.
I know that Podman uses a virtual machine on Mac OS. So I think I should first link the audio of the virtual machine with the audio of the MacOS host like when I mount volumes (first I mount the volume on the VM and then on the container) but I'm not sure. Is there some specific podman configuration or command to use audio, or should I do it manually ?
Do you have an idea?

Access local dags folder from docker bash that runs in Window 10(20.04 LTS Ubuntu)

I first installed the docker in my laptop(docker desktop) and then I run the docker using the Ubuntu 20.04 LST in windows 10.
later I exec the bash so that I could link the local dags folder to my docker dags folder.
bash code:
docker exec -ti 718257f95ec4 bash
Below is my current directory shown in the bash:
airflow#718257f95ec4:/opt/airflow$
I then try to use the below code to link my local Ubuntu 20.04 LTS windows 10 app to the dags but I could not properly find my local dags in my laptop.
Below is the code:
usually when I use only the ubuntu command it will be "/mnt/c/Users/username-name/Documents/dags" but after I access the bash, I do not know how to get into it.
docker run -d -p 8080:8080 -v "This part I do not know how to access it":/dags puckel/docker-airflow webserver
You can use this command to copy your dag code from your host to your docker
docker cp /yourlocalmachinepath/dagcode.py 718:/opt/airflow/dags

docker sharing host directory

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

Run a docker image on Windows results in "oci runtime error: exec: "bash": executable file not found in $PATH."

I'm running Docker on Windows ("Docker Toolbox", not "Docker for Windows").
I've built an image with a rails app inside. It works properly on my Mac OS but stucks on production on Windows.
Using Docker 1.12 and docker-machine 0.8.0 on both machines.
When I create a machine and try to run the container from image, I do:
docker run -it myRepo:myTag bash
which opens me a interactive terminal on Mac OS, but Windows 7 and Windows Server 2011 are both responding with:
"Error response from daemon: oci runtime error: exec: "bash":
executable file not found in $PATH."
I use the MINGW64 shell via the Docker Quickstart Terminal but the old cmd.exe returns the same.
Can anybody help me with this issue? I've tried several hours to find a solution but there are too few answers for Windows.
Thank you in advance!
I also use Windows 7 with MINGW64. Here is what I get using nginx as example:
$docker run -it nginx bash
cannot enable tty mode on non tty input
I don't think you can open a tty using MINGW64.
You can try:
$docker run -i nginx bash
ls
bin
...
You will so no prompt or any indication you are inside the container. Just run ls and it should work inside your container.
Another option is to try to use winpty for the tty:
$ winpty docker run -it myRepo:myTag bash
root#644f59e6f818:/#
Have you tried?
$ winpty docker run -it myRepo:myTag /bin/bash
I haven't got the problem you are mentioning but I have seen it before when I was mapping volumes.
If you are mapping volumes using MINGW64, you will need to add an extra / before the local mapping. For example:
docker run -p 8080:80 -v "/$PWD":/var/share/nginx/html nginx
Let me know your findings.

Resources