Share some Docker Tips

Lately, I’ve been doing a deep dive into Docker and containerization. I’m no expert, but I think I know good enough to be dangerous :P. My self-hosted home lab server runs multiple containers, and my VPN on the cloud runs inside a docker container, hence I wanted to talk more about this technology and curate this thread containing list of Docker tips, tricks and hacks and maybe later we can convert it to a blog post for Developer Nation.

I’ll start. If you ever wish to limit the memory and CPU cores to be used by your container you can do so in following ways :

using docker run

docker run --cpus=1 -m 256m <Image_Name>

or using docker-compose add these in docker-compose file

resources:
        limits:
          cpus: 1
          memory: 256M