How to run an application from a docker container from the host OS?

I am using a docker container with ubuntu: 14.04 and some C ++ application that I compiled inside the docker container.

Is it possible to run the application inside the container from the main operating system (in my case, Win 7)?

Sort of:

docker run <path-to-binary>/mybinary -f 10 -o output.txt

UPDATE:

Yes maybe

docker run -it <my-image> <path-to-binary>/mybinary

Ideally, I want the application inside the docker to be exactly the same as the native applications on Windows.

You can also specify files and a folder in the host OS as input arguments for an application that the docker container cannot see?

UPDATE:

I tried to set the shared folder when the container started

docker run -v C:\shared_with_VM:/temp my_image

and

docker run -v "C:\shared_with_VM":/temp my_image

But I get the error:

C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Invalid
bind mount spec "C:\\shared_with_VM:/temp": invalid mode: /temp.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

As said here, the correct path format in Windows should be

docker run -v /c/shared_with_VM:/temp my_image

+4
1

, ...

, :

docker run -v /host/folder:/container/ -it <image> <executable> <arguments>

:

docker run -v /tmp:/tmphost -it ubuntu ls -al /tmphost
# or in Windows
docker run -v //c/Users/mrgloom/Desktop/data:/tmphost -it ubuntu ls -al /tmphost

/container/ /host/folder. / . , /container/input.txt

+3

Source: https://habr.com/ru/post/1653009/


All Articles