Docker Crash Course #5 - The Dockerfile
Vložit
- čas přidán 7. 02. 2022
- 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 CZcams - • 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 CZcams - • 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/
2 years later still so useful.
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!
This is the most clear explanation I ever seen at CZcams 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!
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
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.
I'm so grateful for people like you in the CZcams! I just needed to review the Docker's main concepts and this series is helping a lot! Thank you!
Glad I could help!
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 !
I've watched multiple tutorial about Docker only you could explain this clearly. keep going (y)
Thanks Michael, that means a lot :)
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.
Perfect tutorials for getting started with Docker
Thanks!!
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 ...❤❤
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!!!!
Very clearly explained. Thank you so much!
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!
Hello
When you bought the course, did you pay it one time or it monthly fees?
@@user-fv3vf5wo9p I paid one time for the docker course only, though there is also a monthly/yearly plan if you want
@@jeremyamon24 ok thank you so much
Excellent explanation! Thank you so much.
Excellent. Thanks a lot for sharing the playlist!
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?
Amazing course as always! Thank you so much!
Thanks for watching Stefano!
You are amazing, thank you very much for sharing this good things
so clear. you are so special in that you are able to make every subject simply understandable.
Thanks so much for your video. It's so helpful for me. Your explanation is easy to understand.
That's great to hear :) glad it's helpful
Very well explained
I am just willing to all course now!! I cant stop myself.
😀
Thank you for your time and generosity
Thanks for watching Zack :)
An excellent tutorial - well explained Mr Ninja - a cold beer to you ...
Thanks Manuel!
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.
I wish this video played anytime anyone ever mentioned docker. then it wouldn't be so mysterious and overwhelming.
Excellent tutorial, just excellent
Appreciate it :) thanks for watching!
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!
Thanks!
amazing
well done
I am so much thankful to this channel, thank you ninja 🙂
Hey ninja, you all right? your breath is a little sick. Thank you for docker playlist :)
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
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
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
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.
thank you so much
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?
Please create a k8s series as well i love you style of teaching
Awesome tutorials ++++++++++++++++++++++++++++ Thank you.
Nice one as always.A little confusion though where are your node_modules from express js installation
he deleted it on purpose to run node_modules with docker
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.
With the port number is this standard for docker or can it be assigned any number?
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
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
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.
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 did not understand how can you COPY . . And get the /api content into /app
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
How i am loving and appreciating this can't be containerized
Where's the source file? I can't find it without paying.
I thought Docker is chaotic.
I waited for app directory in the tree... but it has been stored in the other dimension xd
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