I am new to docker and I have pulled docker image PredictionIO, I need to edit a file in it and re-run but I can't. docker image is not in my directories, too. how can I save the image to my host and edit it?
I use Ubuntu 17.04
thank you :)
There are 3 approaches to your problem:
Run a container from the pulled image.
Then docker exec -it
into it and do your modifications.
After that use docker commit <container id> repository/imagename:tag
.
Use bind mounts to map the file to a host directory and edit the file, this way you dont even need to modify the image.
In order to do this, you need to specify the mount when creating the container:
mkdir /path/to/host/config/folder
create the required file(s) and then create the container:
docker run -d --name mycontainer -v /path/to/host/config/folder:/path/to/container/config/folder/ <repository>/<image>:<tag> <command>
Please note the -v
switch. After this when you exec into container and navigate to /path/to/container/config/folder/
you will see the contents of the /path/to/container/config/folder/
.