Docker Crash Course #5 - The Dockerfile
Hey gang, in this Docker tutorial we'll talk about the Dockerfile and how we use it to create docker images.
🐱💻 Access the course files on GitHub:
github.com/iamshaunjp/docker-...
🐱💻 Node.js Course:
On Net Ninja Pro - netninja.dev/p/node-js-crash-...
On KZread - • Node JS Tutorial for B...
🐱💻 Modern JavaScript Course:
On Net Ninja Pro - netninja.dev/p/modern-javascr...
On Udemy - www.thenetninja.co.uk/udemy/m...
On KZread - • Modern JavaScript Tuto...
🐱💻 React Course:
On Net Ninja Pro - netninja.dev/p/build-websites...
On Udemy - www.thenetninja.co.uk/udemy/r...
🐱💻 VS Code - code.visualstudio.com/
🐱💻 Docker Hub - hub.docker.com/
🐱💻 Docker docs - docs.docker.com/
Пікірлер: 83
2 years later still so useful.
This is the most clear explanation I ever seen at KZread for Docker. All other videos I watched before in other channels they just explain like they are robots.
The greatest explanation about Dockerfile. I was typing things in this file just for the sake of typing because i saw it working in a tutorial, but from now on, i know what each and every single layer mean. Thanks Shaun!
I love your Docker series. Your teaching style is clear, straight to the point, and very methodical. Thanks for the time and efforts you've put into this. Really appreciate it!
You have your dependencies installed after the source code in your example docker file. Docker caches layers, and by installing dependencies before copying the source code, you can leverage this cache mechanism. If the dependencies don't change often, Docker can reuse the cached layer with the installed dependencies, which speeds up the build process. By installing dependencies after copying the source code, the cache will be invalidated whenever your source code changes, even if the dependencies remain the same. This leads to longer build times.
thank you so much for this mr shaun ! you really helped me with my work. i really cannot understand docker for a long time but you explain it so simple and clean ! Thank you, keep it up mr Shaun !
This was exactly what I needed, thank you and well done. Clearly explained, with specific elucidation of the command usage and meanings. I'll be checking out the rest of the videos in this series as I still have questions around the 'AS base' and 'AS build' modifiers as well as how 'ENTRYPOINT' works.
finally someone that takes the time to actually explain the syntax while they go along.......the structure of the language is critical in order to learn, yet so few actually tell you what you are doing, they just tell you enter this blah de blah enter that yada yada. Thanks man i was going crazy trying to find something that gave me a clue lol
I'm so grateful for people like you in the KZread! I just needed to review the Docker's main concepts and this series is helping a lot! Thank you!
@NetNinja
Жыл бұрын
Glad I could help!
Thank you! This is the best explanation by far I've seen, I'm confused for couple days.
I have seen many long and boring Docker tutorials, but this one! Amazing. you made my day. thank you a lot ...❤❤
@NetNinja
Жыл бұрын
Glad it was helpful! Thanks for watching Hooman :)
This is the cleanest, most understandable video of dockerfile
Didnt realise the upload date of the video untli I reached the end!! Eagerly waiting for further parts!!!!
I've watched multiple tutorial about Docker only you could explain this clearly. keep going (y)
@NetNinja
Жыл бұрын
Thanks Michael, that means a lot :)
Excellent. Thanks a lot for sharing the playlist!
I just bought this as my first course on your website because not only that I want to access the rest of the course now, but I feel that should since I've been freelancing for the past year now thanks to your videos. Thank you!
@user-fv3vf5wo9p
2 жыл бұрын
Hello When you bought the course, did you pay it one time or it monthly fees?
@jeremyamon24
2 жыл бұрын
@@user-fv3vf5wo9p I paid one time for the docker course only, though there is also a monthly/yearly plan if you want
@user-fv3vf5wo9p
2 жыл бұрын
@@jeremyamon24 ok thank you so much
Very clearly explained. Thank you so much!
Perfect tutorials for getting started with Docker
@NetNinja
Ай бұрын
Thanks!!
Excellent explanation! Thank you so much.
Amazing course as always! Thank you so much!
@NetNinja
Жыл бұрын
Thanks for watching Stefano!
so clear. you are so special in that you are able to make every subject simply understandable.
I am just willing to all course now!! I cant stop myself. 😀
You are amazing, thank you very much for sharing this good things
Thanks so much for your video. It's so helpful for me. Your explanation is easy to understand.
@NetNinja
Жыл бұрын
That's great to hear :) glad it's helpful
Very well explained
Thank you for your time and generosity
@NetNinja
Жыл бұрын
Thanks for watching Zack :)
An excellent tutorial - well explained Mr Ninja - a cold beer to you ...
@NetNinja
Жыл бұрын
Thanks Manuel!
I am so much thankful to this channel, thank you ninja 🙂
I was waiting for someone like you to make a course on Docker! Here we are ! Next is Kubernetes ! When are you going to do the honor?
Excellent tutorial, just excellent
@NetNinja
Жыл бұрын
Appreciate it :) thanks for watching!
amazing
I wish this video played anytime anyone ever mentioned docker. then it wouldn't be so mysterious and overwhelming.
Hey ninja, you all right? your breath is a little sick. Thank you for docker playlist :)
well done
Great tutorial as usual. One point, what will happen if we change package.json to reference a new dependency, will the previous version get installed from the cache? This could be a big issue.
thanks for the free presentation. BUT .. often recomended - and only where it is possible: I would appreciate a much larger, more noticeable, maybe colored pointer/cursor, moved with a calm hand to allow me following more easily your brilliant thoughts.
Great tutorial!
@NetNinja
11 ай бұрын
Thanks!
Please create a k8s series as well i love you style of teaching
WORKDIR - specifies where the commands should run RUN commands are run at image build time. This means commands that we want to actually be executed on runtime should be added in CMD
I think the order of commands should be different to speed up rebuilding image. I would first copy packages.json into /app, then run npm instal, and finally copy the rest of the app files. Thanks to that approach, after modifying something in app files, reinstall of npm packages won't be necessary. Small caveat: It requires to set up volume to be able to develop our app locally without need for rebuilding.
Awesome tutorials ++++++++++++++++++++++++++++ Thank you.
Great explanatiion
@NetNinja
Күн бұрын
Glad it was helpful! :)
In laravel there is a package by names of laravel sail that will write the docker-compose file automatically for the project. hope u make some tutorials about laravel too
thank you so much
@NetNinja
8 ай бұрын
You're welcome!
👌👌👌👌
You said, every line after "WORKDIR: /app" would run in /app directory. Then while executing the COPY statement, would not it take source as /app. Which means, copy all from /app to /app?
May I ask? Shouldnt we use the first parameter of command COPY with 2 dots to specify root directory where all the files are stored? As our working directory is /app already.
9:00 Does WORKDIR create an "app" folder if it doesnt already exist? Since you said image file structure is completely different to a project's file strcuture
Nice one as always.A little confusion though where are your node_modules from express js installation
@apolomoraes1767
Жыл бұрын
he deleted it on purpose to run node_modules with docker
👍👍
With the port number is this standard for docker or can it be assigned any number?
How i am loving and appreciating this can't be containerized
does the github link always default to the main repository with readme file in the youtube videodescription or is it possible to change it to the other repositories like lesson 5 which contain the files shown in video
@202prince1
2 жыл бұрын
You need to change the branch to access respective lesson files. Like change the branch from main to lesson-5 for lesson 5 files.
didnt see api file on the links, can you show me where is it?
what about file permission in docker ? how to create user inside docker for logs permissions
@alexanderpoplawski577
2 жыл бұрын
All commands during image build and in the container are executed as root. Since the base image is a linux system, you can run commands to add a user and switch to that user in subsequent commands in the Dockerfile. I am pretty sure all this will be explained in more detail during the course. Be patient!
Where do i open the lesson 5 at? Help, i'm a Dummy
What if I need to install global package from that node version at specific version and use it in cmd? Eg I need cordova@10 (11 is latest) and use 'cordova build' command? What if I change sth in code? Do I need tk build it again? I'm guessing yes, asking to be sure.
@alexanderpoplawski577
2 жыл бұрын
Just add a RUN npm install -g cordova@10 to the Dockerfile. After that you can add RUN cordova build. Yes, if you change something in the Dockerfile or the content, that goes into the image you have to build again. There is an alternative with volumes, but I think Shawn will address this in the following parts.
I waited for app directory in the tree... but it has been stored in the other dimension xd
Where's the source file? I can't find it without paying.
I did not understand how can you COPY . . And get the /api content into /app
@akaharrison1644
2 ай бұрын
In my own understanding is that, he create a dockerfile in same directory with dependencies and app.js, that's why he runs the command COPY . . which the first "." represent the relative directory that all of them are located then the second "." is telling the command to save everything in the "WORKDIR /app" created
Please the simple node project isn't in github.
Isn't it a bit too fast for beginners?!
takes so much time on RUN npm install after 397 seconds it fails