Home > Categories > Docker > Developing in Container With VS Code

Home > Categories > Ubuntu > Developing in Container With VS Code

Home > Categories > Hugo > Developing in Container With VS Code

Home > Developing in Container With VS Code

Developing in Container With VS Code

Updated:

7 Dec 2020

Published:

7 Dec 2020

As developer we have to maintain lots of dependencies. Even if you have not used specific language or cli.

We keep updating them on daily basis.

And many times some update fails and we waste half a day fixing dependency that we have not used for months in past and won't use for many months in the future.

Also we want to test out beta or edge or current version of some software but we are afraid to mess up our daily work environment.

Now we can develop inside a disposable docker container. And only update the dependencies that we need immediately.

And also test out latest beta version without disturbing our daily development environment.

Most importantly no more excuse of "It works on my computer".

Now we can have same environment on every computer whether it's windows, macOS or linux.

Also helps to quickly onboard new employees and have same environment company wide.

To read rest of the article please Purchase Subscription

Pro Tip: Enable Subtitle

View my personal dev container setting collection on github

If you add --no-install-recommends while installing packages in Ubuntu like

apt-get -y install --no-install-recommends package_name

then you can expect to reduce docker image size by 60% and increase build time by 15% according to Ubuntu.

Your mileage may vary depending on which package you are trying to install.

Docker container doesn't care about the local machine time zone.

Every container will have UTC time zone or Zulu time zone. In most cases you don't care about time zone.

But for example if you are writing blog post and setting date/time for post then it will be set in UTC time zone. This can be annoying.

I use my container with WSL2 so I just mount timezone file of WSL2 on the container as follows.

Again the suffix :ro stands for read only. So container cannot overwrite those files.

One important thing to notice from following examples is that in every Dockerfile the first many lines of code is same.

So this way docker will build only once and reuse same cashed files in rest of the development containers.

This will help you not get banned for constant downloads. But also speed up building containers.

View my personal dev container setting collection on github

Legacy Hugo with Docker and Docker-compose

This is legacy solution for information only. It does work perfectly fine.

But its not maintained over time and there is better solution that is recommended by Microsoft and maintained by Microsoft.

See my collection of dev container settings on github.

Dockerfile

Docker-compose

Free users cannot comment below so if you have questions then tweet me @apoorvmote. I would really like to hear your brutally honest feedback.

If you like this article please consider purchasing paid