Thanks for the feedback! Glad you enjoyed the video. It wasn't specifically about PHP, but the general concepts should still apply. I'm curious if this video inspired you to give a PHP DevContainer a try?
Thank you. The command "tail -f /dev/null" is a technique to keep a service container running indefinitely. I use this in DevContainer setup is to override the default CMD defined in Dockerfile. By default, I like the app run (in this case - the command is 'rails s -b 0.0.0.0') when used outside the DevContianer setup, but in the DevContainer I prefer it load the container without loading the application (rails) but we just need the the environment without everything installed. The command "tail -f /dev/null" essentially does nothing but wait indefinitely for new data to appear in /dev/null, which never happens. I hope this helps.
Not really, for the example code. But here are a couple of scenarios to test, The Dockerfile in the example has the CMD that runs the application server (rails s...). With that if you omit the "command" in docker-compose.yml, upon DevContainer Rebuild/Ropen, it should loan the environment just fine. But it already starts the application server (rails s ..). You should be able to hit localhost:3000/ and it should respond. Because I don't want it start the app server on loading the container environment, I set the command in docker-compose.yml, to basically do nothing. Another option, if we don't want the app server to start on loading the container environment, you could just change the CMD to either tail /dev/null or do something that is long running. That way, you can omit the "command" from docker-compose.yml And the "command" that tails /dev/null is omitted and CMD from Dockerfile is removed, DevContainer will fail to start as the container will exit as soon as it starts. It needs a command that runs idefinitely.
Can you help me in github codespace as i am using docker compose file to lauch postgres along with pgadmin but it is not opening in browser. Pgadmin is showing not reachable even port is also forwarded. Dont know why its not accessible from browser
I haven't really tested any devcontainer setup on github codespace but I can give pgadmin and postgres a try. Can you share the docker-compose example you're working on? Even better, if you have github repo that you can share
@@maheshsharma-zq2uc - I was able test a quick setup on github codespaces. Let me now if this is kind of setup you were hoping to create on github codespaces - dev.to/shettigarc/easy-github-codespaces-setup-your-app-postgres-and-pgadmin-3b08
I have been using DevContainer for a long time now.. this is really good video.. crisp and clear.. covering many scenarios .. Thank you for video !
Thanks for watching and for your kind words, Shakti. It's good to hear you're already familiar with DevContainer and found the video valuable.
What a great video. I just wish it was a php setup!
Thanks for the feedback! Glad you enjoyed the video. It wasn't specifically about PHP, but the general concepts should still apply. I'm curious if this video inspired you to give a PHP DevContainer a try?
Really nice and concise content, Chandra. Thanks!
Glad you liked it! Thanks for watching and sharing your thoughts.
Great video!!! Also, I liked the way you setup multiple containers 👏👏👏
Glad you liked it!! Thanks for watching and sharing your thoughts.
Great tutorial! Btw, I have a question. What is the purpose of the command in the app service? The "tail -f /dev/null" command? Thanks
Thank you.
The command "tail -f /dev/null" is a technique to keep a service container running indefinitely. I use this in DevContainer setup is to override the default CMD defined in Dockerfile. By default, I like the app run (in this case - the command is 'rails s -b 0.0.0.0') when used outside the DevContianer setup, but in the DevContainer I prefer it load the container without loading the application (rails) but we just need the the environment without everything installed.
The command "tail -f /dev/null" essentially does nothing but wait indefinitely for new data to appear in /dev/null, which never happens.
I hope this helps.
@@ChandraShettigar Is there a problem if I omit that command?
Not really, for the example code. But here are a couple of scenarios to test,
The Dockerfile in the example has the CMD that runs the application server (rails s...). With that if you omit the "command" in docker-compose.yml, upon DevContainer Rebuild/Ropen, it should loan the environment just fine. But it already starts the application server (rails s ..). You should be able to hit localhost:3000/ and it should respond. Because I don't want it start the app server on loading the container environment, I set the command in docker-compose.yml, to basically do nothing.
Another option, if we don't want the app server to start on loading the container environment, you could just change the CMD to either tail /dev/null or do something that is long running. That way, you can omit the "command" from docker-compose.yml
And the "command" that tails /dev/null is omitted and CMD from Dockerfile is removed, DevContainer will fail to start as the container will exit as soon as it starts. It needs a command that runs idefinitely.
Can you help me in github codespace as i am using docker compose file to lauch postgres along with pgadmin but it is not opening in browser. Pgadmin is showing not reachable even port is also forwarded. Dont know why its not accessible from browser
I haven't really tested any devcontainer setup on github codespace but I can give pgadmin and postgres a try. Can you share the docker-compose example you're working on? Even better, if you have github repo that you can share
@@ChandraShettigar sure I will share it on tomorrow
@@maheshsharma-zq2uc - I was able test a quick setup on github codespaces. Let me now if this is kind of setup you were hoping to create on github codespaces - dev.to/shettigarc/easy-github-codespaces-setup-your-app-postgres-and-pgadmin-3b08