New Tutorials:   JAVASCRIPT    SASS/SCSS    PL/SQL  
   Docker  DevOps  
   Technology    Innovation

Docker Best Practices for Devops

 SEPTEMBER 14, 2019   by damon

Docker is gaining more and more popularity which growing inclination towards building microservices and more modular applications. Also, using docker reduces the time of setup of your application on the new, fresh server very easy. If you use docker, you can use Kubernetes with it to even manage the load on your application by replicating your application automatically.

So below we have 21 points listing some good practices for Docker.

1. Build Images to do just one thing.

2. Use tags to reference specific versions of your image.

3. Prefer minimalist base images.

4. Use Multi-stage Builds.

5. Don't use root user, when possible.

6. Use official, purpose-built images.

7. Enable Docker Content Trust.

8. Use Docker bench for security.

9. Leverage Docker enterprise features for additional protection.

10. Writing a docker file is always critical, build docker image which is slim and smart not the fat one.

11. Persist data outside of a container, or have your database in a separate server or a separate docker container.

12. Use Docker Compose to configure your applications service, which will make it easier for you in future to expand.

13. Use Role-based Access Control (

14. Do not add user credentials/server private keys/critical data to the Docker Image or Docker File. Use it as a Deployment Variable.

15. Make use of docker caching, try pushing "COPY.." to the last line in Dockerfile if possible.

16. Use .dockerignore file.

17. Don't install debugging tools, you will save a lot of space and will be able to reduce the size of your docker image.

18. Always use resource limits with docker/containers.

19. Use swarm mode for small application.

20. Don't blindly trust downloads from the docker hub! Verify them!

21. Make a Docker image with tuned kernel parameters.

Pheww! too many points to remember. So you better bookmark this so that you can refresh your memory whenever you want and also check if you have missed any crucial point while deploying your own docker container.


Subscribe and receive amazing posts directly in your inbox.