I have a little question about docker. Please understand me, I`m elementary level about docker. I’m using CentOS 7 Linux.
When I use docker (images), (espatially dropest(https://dropest.readthedocs.io/en/latest/setup.html#installation) I understand, and download image successfully with code below :
docker pull vpetukhov/dropest:latest
and get start with code below :
docker run -it vpetukhov/dropest
and copy my files to runing with dropest
(Copying files from host to Docker container) with code below :
docker cp ./myfile acb889c0c379:/home/user
and running dropest(the program what I use), after running dropest, copy output files to my linux server.
docker cp acb889c0c379:~/outputFilePath/outputFile.txt ./outputFile.txt
In conclusion: docker run CONTAINER -> copy file to CONTAINER -> running program -> copy outputFile to server.
I just want use ‘dropest’ program! there is nothing else what I want in Container.
Is there any other option? like:
[myID@server]$docker run [something option] dropest (dropest command with myFiles)
(myFiles are located on server)
then obtain outputFiles on server
Please help. Best regards.
2
Answers
Look at the life cycle about docker container! I follow this picture to make solve the problem @Niels Hofmans's answer is really useful for me.
If you are korean, please try visit here :https://0902.tistory.com/4 and here :https://0902.tistory.com/6?category=675093
first,
docker create -v [path where you want on your server]:[path where you want on your CONTAINER] --name [what you want] -it vpetukhov/dropest
In my case:
docker create -v /home/hanjg/imsi:/home/user/Data_host --name imsi_mount -it vpetukhov/dropest
You don`t have to make imsi folder(directory) and Data_host folder(directory). docker make folder automatically.
docker start imsi_mount
docker attach imsi_mount
Finally, you are enter your CONTAINER and try
cd Data_host
It is same as '/home/hanjg/imsi' on your server! : '/home/hanjg/imsi' repository mount on docker CONTAINER! (in my case vpetukhov/dropest CONTAINER)
Thanks!
Why not just bind-mount your files into your container?
e.g.
docker run -v "/path/to/your/files:/files" -ti --rm vpetukhov/dropest:latest /files/