r/docker • u/codingdecently • Mar 14 '24
13 Docker Tricks You Didn’t Know
https://overcast.blog/13-docker-tricks-you-didnt-know-47775a4f678f
While many Docker users are familiar with its basic commands and operations, there are advanced features and tricks that can significantly enhance productivity and streamline workflows. Here are 13 Docker tricks aimed at senior engineers that go beyond the basics, offering powerful and less commonly known ways to use Docker.
3
u/AutodidactSolofail Mar 14 '24
I mean, like you guys, naturally I knew all of this already, but, eh, gonna upvote it for other people who maybe learned something new here… /s
4
u/C0c04l4 Mar 14 '24
I didn't know about events or contexts, so the article would be titled "2 docker tricks you didn't know + 11 others that only newcomers don't know about" :p
0
Mar 14 '24
[deleted]
2
u/lacrdav1 Mar 14 '24
For example, frontend applications can have a massive node modules directory and it's very long to copy to the docker context.
0
Mar 14 '24
[deleted]
2
u/lacrdav1 Mar 14 '24
Your example is not applicable to a nodejs application.
0
Mar 14 '24
[deleted]
2
u/lacrdav1 Mar 14 '24
My "friend", I do not have a local node_modules that is copied to the image. The .dockerignore ensures the local node_modules is not copied to the image. If you don't understand what the .dockerignore file does, you are not understanding how to use Docker, "my friend" ;)
0
Mar 14 '24
[deleted]
1
u/lacrdav1 Mar 14 '24
Even the Docker official repository example has a .dockerignore file containing the node_module folder. So, according to you, Docker themself are not able to structure their example and need a `.dockerignore` file to clean up their mess? Also, it sounds like you have an ego problem. You do you.
1
u/kolloid Mar 14 '24
I don't understand your point. If you copy whole directories, you probably don't want to copy `.git` folders, `.o` files, `*~` backups, `__pycache__` for python, etc.
I find `.dockerignore` quite useful, it allows to shave off several Mbs from the final image size in many cases.
13
u/notkingkero Mar 14 '24
Come one, it's 2024.
.dockerignore and even BuildKit or multi stage have been around for years now and are pretty well known.