Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker running the containers and modifying environment settings

Set up is on a Ubuntu 18.10 x64

Trying to set up a set up a Laravel, Nginx, and MySQL droplet with Docker Compose, with this tutorial docker tutorial and I get all the way to step 8 in the tutorial where it asks me to run this command

$ docker-compose exec app nano .env

and it gives me an error of

OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"nano\": executable file not found in $PATH": unknown

I have spent the better half of a day looking on line for any kind of help or clues on what i could have done wrong. any info I can give you please let me know.

Thank you in advance!

like image 868
whisk Avatar asked Oct 23 '25 15:10

whisk


2 Answers

Well... This error throws because there is no 'nano' editor installed in this container. If you're familiar with vim you can use it like this:

docker-compose exec app vim .env

You also can enter to the container's shell and then install nano to use it like that:

docker-compose exec app /bin/sh

and then in container install nano editor. Installation command will depends on the OS. For example, if container is based on ubuntu youll need to type:

apt-get install nano

of if it's based on alpine-linux:

apk add nano

and so on... You can google it easily ;) You can check which OS it is using next command:

lsb_release -a

Hope it helps ya

like image 173
Andellys Avatar answered Oct 26 '25 13:10

Andellys


you can go inside container with specific user and this case you must have root :

docker exec --user="root" -it <container_name> /bin/bash

then :

apt-get install nano
like image 42
Amir Kaftari Avatar answered Oct 26 '25 12:10

Amir Kaftari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!