Hi everybody!
I am very new to docker, as a matter of fact I stumbled upon it because I am using openFOAM for mac.
I am having some troubles editing text file inside of the docker, which is an action I need to perform pretty often when working with openFOAM.
I usually start openFOAM, which I suppose works inside a docker container. Once I do, I log in as “ofuser…” and I can navigate through my files in Mac. The problem is that when I try to use nano to edit files i receive a:
bash: nano: command not found
I tried to do a “apt-get install nano” but i get this instead:
bash: apt-get: command not found
I also tried to use the “cat” function, but it’s not really what I am looking for.
At the moment I’m using two different terminal windows, one logged in the docker the other as mac user. The problem is that this way I have to navigate to the folders twice, which slows down the process considerably.
Is there a way to install nano (or any other text editor) inside the docker?
Thanks
now I have nano, but apparently I have lost access to my home folder, which is kind of a bummer. Somtimes navigating through many folders through terminal is a bit painful (to me) and i’d rather do that via finder. Also it happens at times that I might just wanna have a look at a file without having to go into the container through terminal…
Do you know of a way to use your home folder inside the container?
using the version of OpenFOAM on the https://www.openfoam.com/ it’s still possible to access my /Users/MyName folder. With the version from openfoam foundation it is not. I was wondering if there was a way to access that folder… I don’t know if it is any more clear now…
The -v option allows you to map folder in your container with a folder on you PC here is an example docker run command.
docker run --name containername -d -it -v ~/PCdir/:/Containerdir containername /bin/zsh you can then edit files on your pc and have the changes saved in the container…
In the end the problem was that I was running a version of Fedora, not Ubuntu. Entering the docker as root and using yum, allowed me finally to install nano. In case someone happens to have the same issue this is how to:
run your container
in a separate terminal window use this: docker exec -it bash
now run: yum -y install nano
As for accessing the home folder from my second container, I’ll try to meddle with it for a while and see if I manage to do it.