mage2click / docker-magento-mutagen

Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
https://mage2.click
MIT License
68 stars 9 forks source link

Use container id for docker commands #20

Closed jerrylopez closed 5 years ago

jerrylopez commented 5 years ago

FYI, I opened https://github.com/markshust/docker-magento/pull/150 on the markshust/docker-magento since this is based off of that project.

When using the bin scripts I noticed that sometimes the commands worked and sometimes they would throw an error like this:

Error: No such container:path: magento-231_phpfpm_1:/var/www/html/auth.json

In this situation, my directory name is docker-magento-231 and the container's name is docker-magento-231_phpfpm_1. Weirdly enough anything from the first - and before is being omitted from the docker commands. I found that the width of the terminal window was actually affecting this.

Example If the window was wide enough the docker commands run just fine because the container name is correct

image

If the window is too narrow the container name is trimmed because the docker-compose name output is multi-lined

image

I found that the issue lies when grep is used to retrieve the container name. I tested out grep in a different scenario and it doesn't seem to be the cause of the issue. A co-worker actually mentioned that this could have something to do with docker-compose and how the data is piped.

I didn't dig too much into the situation because I went the route of using the container id instead for the docker commands.

shkoliar commented 5 years ago

Yeah, it appears that on narrow window docker-compose ps command returns a table with multiline text in columns. After that, grep fetches the line what includes search query and in result, not complete container's name.

temp1 temp2
u-maxx commented 5 years ago

Thanks a lot for your contribution @jerrylopez !