Build YOUR OWN Dockerfile, Image, and Container - Docker Tutorial
VloĆŸit
- Äas pĆidĂĄn 2. 06. 2024
- We spin up all types of containers on my channel in my tutorials but we have yet to build our own custom Docker container image. Today we'll start from scratch with an empty Dockerfile and create, build, and run our very own custom Docker image! We'll learn all the commands that everyone should know when building and maintaining images with Docker. This Docker tutorial is a great way to get started with Docker!
Video Notes: technotim.live/posts/custom-d...
Support me on Patreon: / technotim
Sponsor me on GitHub: github.com/sponsors/timothyst...
Subscribe on Twitch: / technotim
Become a CZcams member: / @technotim
Merch Shop đïž: l.technotim.live/shop
Gear Recommendations: l.technotim.live/gear
Get Help in Our Discord Community: l.technotim.live/discord
2nd channel: / @technotimtalks
(Affiliate links may be included in this description. I may receive a small commission at no cost to you.)
00:00 - What is Docker?
00:27 - What is a Container?
01:00 - What is an Image?
01:18 - What are we doing Today?
01:47 - It all starts with a Dockerfile - FROM
03:20 - Environment Variables - ENV
03:51 - COPY Command
04:20 - Source files
05:57 - COPY command destination
06:39 - EXPOSE (You don't need this)
07:17 - CMD Entry point
08:13 - How to Build a Docker image
09:16 - Building image with a tag
09:47 - How create a container
10:47 - See our container running
11:23 - Stopping and starting containers
12:10 - Cleaning up containers and images
12:33 - Dockerignore files (how to ignore files)
13:51 - Docker exec into a container
15:23 - Add file to dockerignore file
16:50 - Other base images
17:52 - Stream Highlight - "Traefik is a series of tubes"
#Docker #DockerContainers #Containerization
"Switchstep" is from Harris Heller's album Insomnia.
l.technotim.live/sb-music-lic...
Thank you for watching! - VÄda a technologie
Have you built your down Docker container yet?
Building soon. Thanks again.
Yes and I do prefer to do so especially to avoid any crypto mining packages from a third-party image. Two things that I think are cool to share about it in the next video is about the tag USER -- it took me a while to find out about it -- and Docker's buildx -- especially for developers that use SBC as their homelab -- as do I.
I was actually working on figuring out a quick little Nginx container for a school project, and this is SOO much simpler than other tutorials I found online, plus you just plain explain thing beautifully. Your videos are just amazing!
@@quinnhenry6719 Thank you so much!
I have avoided containers for a long time now. But I am having to face the fact that I for some things I no longer have an option but to run them as containers - and some of those tools want me to build my own docker images.
I was wondering what tool you are using to create your docker files - it has some sort of integration with docker hub, and auto completion (both features I could use, as I don't intend building docker images to be a main part of what I do).
Thank you so much for NOT starting this with "here's how to download docker, here's how to install docker".
Wow, what a great tutorial. In less than 20 minutes you explained what others would have taken hours. Thank you!
I just wanted to drop you a quick note to express my appreciation for the fantastic video tutorial you created. Your clear explanations and step-by-step guidance made learning 'Docker containers' a breeze!
finally an actual practical tutorial that doesn't spend 90% of the time just explaining a bunch of boilerplate things like how to install it & what containers even are.
This is the first video on docker that I have watched that makes sense of docker for me, in a way I can understand. Thank you so much! Now I'm going to attempt my first container đ
Omg. Youâre video was amazing. So easy to follow and understand. I think I learned more about docker from you than multiple other videos. Thank you!
Your teaching style is great!
Would love to see more from youđ
This timing is legendary. I just started looking into using containers for my setup and the first video i see is this one. Awesome vid btw, just what i needed
Couldn't agree more about the timing. Although I have been using docker for over a year I only recently built my first docker image which is a clone of wordle and also happens to be based on nginx-alpine. đ
Great video! Id love to see a similar video detailing containers and storage. Like covering the different options that are available to persist data.
Man this tutorial is super awsome and beginner-friendly. The presentation style is awesome - to the point and just the enough amount of info in one video. Thanks a lot!
Awesome!! Exactly what I needed. You sir, are a legend
Nicely done. Lots of help in one place, with end to end examples, in pretty much no time at all. Thanks!
Bro this video is amazing. I just discovered Docker a few weeks ago, I had always just used Virtual Box or VMWare VMs. I figured out how to spin up a Unifi container pretty quickly, but what I really wanted to know was how to build my own container so I could do some custom things. This video tutorial is perfect!!
Definitely agreed with all the other comments, great tutorial and a lot of gems worth diving deeper on outside of this video.
3 improvements IMO - 5 to 10 seconds without wasting time
1 - mention the OS you're on
2 - mention the installer of Docker you used
3 - actually show the Dockerfile being created so it's clear about file extension
I'm seeing the bigger picture more and more now.
I've watched literally dozens of videos about Docker on YT and found them confusing and lacking. This video is awesome and explains it all. Would recommend.
Thank you so much!
Thanks for this - I had no idea how to do anything but copy paste stuff for docker/portainer this morning. Followed this then a few hours later have managed to get automated builds from Github to Dockerhub, and then deployment from there to my home server for easy iteration!
DUDE thank you! I've been looking for a video like this that starts from the beginning and does a simple example that's easy to follow. Usually the videos all show these big applications that they are wanting to containerize and it can be hard for a beginner to follow along.
Glad to hear it!
I did! Well done video, I probably won't need to be building my own containers much but had a special case, need to set up a quick web server to test something. Video was great! Oddly probably the most useful thing for me in the video was "exec into a container". I only knew how to do that from portainer and it wasn't working on one container but through this command in docker I was able to do it!
Something many of us have wondered about as we install containers đ Thanks!
Very good my man. Loved this sort of thing!
Just great overall stuff... Please do more along these lines. I can tell you were "right at home" with this stuff, but it was so good for me. So good, thank you.
Thank you!
@TechnoTim, this is a great tutorial. Thanks for putting this together!
Thanks for the video! Maybe the best introductory video for docker!
Your videos are phenomenal, yesterday I started looking at Ansible on your channel and made me wanna learn Devops (Ansible and Docker). Thank you so much, your explanations are by far the best on YT. Thank you once again, all the best! đ
Glad you like them! Thank you so much!
Best Docker tutorial by Johnny Depp
Clear and concise. Thank you!
Gold standard content. Thank you
Another GREATI video! I love your tutorials. You started out with really "good" content (I've watched from day one), but now, it's at a much higher-level. This tutorial with your direct, to-the-point explanations, really helped me. I've tossed up Docker and K8s but the amount of notes I have is overwhelming. Especially when I want to spend five minutes and not five hours. I set this to over 100 contacts at work, and about 180 (I forget the number in the email group) at home. Programming friends who like similar content.
Keep up the great job! (Now rewatching "Uptime Kuma" video to get it working in my new K8s.)
Thank you so much! Recommending my channel to friends helps more than you know and I really appreciate it!
super easy to follow along and properly explained
High quality video. Thank you.
Yep, It was simple enough and useful for me. Thanks
Iâve used Docker for 4-5 years. Just wanted to watch and see how you covered it. Great tutorial. You should do a video on Docker-compose if you havenât already. I think your teaching and explanation of things is some of the best on CZcams. Also you can show people Docker desktop and how you can alternatively do some of this stuff via Docker desktop once they learn the basics.
I think I also watched a video of yours a while back talking about dual booting from linux and windowsâŠyou earned my sub back then cuz your explanation was amazing as it is also in this video. Keep up the awesome work. Iâll be on the lookout for new content so I can learn something new
Thank you so much! A lot of time and effort goes into my choice of words and how I explain thing so I appreciate you noticing and leaving such a nice comment! More where that came from!!
really great tutorial and just what I needed!
Really very cool explanation. Will be checking out your content. Thanks man!
Excellent short tutorial on Docker.
Glad you liked it!
had never understood the purpose of .dockerignore... the way you explained is simply superb
Your videos are great and they really helped me a lot. Thank you for your effort.
Thank you for this video with explanation
This is awesome!! Thank you so much!!
Amazing timing Tim!
Fantastic content, greatly explained and so clear. Thank you and keep going. you just have a new subscriber :D
Excellent tutorial thank you !
I think this tutorial was really awesome. Thank you! I followed along and tried all the things while watching. Didn't bother building such a fancy web page tho xD mine was just a hello world, but you got the point across neatly!
great tutorial, thank you â€đȘ
Techno Tim - you are man and good tutor! THX ALOT!!!
excellent work, thank you!
Hi , this is very useful for me ... thank you very much I'm using this tutorial to improve my self with docker projects ..
Awesome, that was very clear and easy to follow, thank you đ
Thank you!
Great video as per usual Tim! I'm developing an IaaS platform for consumer grade hybrid clouds and your videos have helped immensely. Thanks!
Awesome, thank you!
Muy buena explicacion... Estoy empezando con dockers y este ayuda mucho. Gracias x compartir
Wow!..Thanks so much for this video! It was the best explanation I have found! I really learned alot!...Thanks again.
Great job with the tutorial Tim! đIf anyoneâs looking for more Docker videos, weâve released a web-based Docker viewer and a logging tutorial to help the community too đȘ
Great tutorial đđđ
Looking forward to the container registry video,
I currently use Gitea with Woodpecker to run CI pipelines, but it is very slow when I need install dependencies before it runs my code, it would be great to pull from my own container registry that already includes all the build tools I need.
great explanation, very helpfull , like and subscribed
Great video, thanks!
Thanks, I learned something!
Thank you! I've created my own docker container!
Thanks Tim, very informative, I cam to learn how to docker build but got alot more useful info ,thanks
Glad you enjoyed it
Thank you for all your videos. I was able to learn a lot from your work and videos and it would have been much harder to read books and documentation instead.
I often see you in your videos typing code into VS Code and "magically" completing "things". Perhaps you can briefly explain at this point which VS extensions you installed and why? Or is it even worth making your own video for it?
I hope you have fun making videos like this for a long time to come.
This is great tutorial. Thanks!
Glad you enjoyed it!
Hi nicely put together in few minutes. Nice...
Great video and flawless presentation skills!
Instant sub!
Thank you!
That intro was smooth !
This is an awesome tutorial! You simplified the process of learning Dockerfiles.
I wish this video existed when I was learning docker.
Would you make a video on Docker Compose and deployment to Kubernetes?
5 years later and youâre still teaching me đ€
Hey man! Thanks!!
A container is a runtime environment that only contains the configuration and dependencies required to run that software only. It differentiates itself from a VM because VM's contain everything required to run the OS plus the runtime. I've had to explain this a billion times at work. Thanks for the video!
Thank you! Just send them this! :)
I finally understand it bro yes thank you
great video!
You just saved my a$$ bro!!! Thanks a lot
What an absolute banger of a video. Loved everything. The editing, the pace, what you explained. I learned more in 18 minutes than in other 2 hour long videos about the subject.
Got a question, and would love some pointers on how to search for it:
I work on web dev and we're having issues running the project on arm / m1 machines, as the project setup is really finicky and needs a really specific host configuration to build the way it should.
So my plan with docker is to create an image with everything I need to develop _inside_ the image. Meaning a fully-fledged ubuntu-based image with my zsh, neovim, nvm to manage npm+node, including my configs for all those programs, and my work project too. Pretty much a 'clone' of the important stuff of my PC.
I've done simple nginx releases in the past, but i'm completely lost on how to tackle something this complex.
- I would work by exec-ing into the docker image. Performance is not an issue, as the image-runner would be really beefy.
Thank you!
It is helpful. thank you
really loved ur video
Iâm just here to say that the title and title screen on this video are fantastic.
Thank you!
how do you always know what i'm about to do haha, insane timing
It seems like he's on the same journey. If you start building a homelab and run into his channel, follow along and make what he makes, the next step is usually in the next video.
I don't know if he has all this planned out but it sure seems like it. Fantastic series and finally helped demystify docker for me.
Great video Tim..
Could you perhaps do a follow-up on the CI part?
Thank you !!!
Nice explanation
Thank you!
Thanks a lot :)
Actually its rather easier. Now i have 4 images that i use to test my scripts or to mess around with and it took very little time to setup. I couldn't find a good example for building a dockerfile, but will in the long term. I think in the end dockerfile is the way to go. However, what i did was collected a folder with all my scripts and stuff, and created some scripts to setup my environment, which included downloading cli apps like nano, tmux, vim (to practice), wget, curl and mc. Then i copy my dotfiles to /root, and then source the new .bashrc, and voila, a perfectly (for my use) docker container!! excellent!!!!
great video
Hi, great video, I love what you are doing and I'm following a lot of tutorials and tips from you. About docker, as explanation of why you removed EXPOSE and CMD is that when you create a dockerfile "FROM" an image, it will inherit all the EXPOSE and CMD from the original image, you can override them like you did in case you want other entrypoint CMD than the original. You can go on DockerHub on that image and then to Tags, search for your image and when you click on the image name you will see the sets of instructructions of the Dockerfile of that Image.
Thank you! Great explanation!
Thank you Tim for an amazing video once again! Addition to this can you cover SSL for docker containers be cover in your next video if possible or else a link to a super simple guide would do it. đ
Already did :) czcams.com/video/liV3c9m_OX8/video.html
Boa thanks man :D i just needed some "how to .. for dummies" :D
We are all dummies at some point!
Thx, this gave me a good short overview how to start. Could you show how to insert binarys/software into the build container? Some extra libs as an example? I like to see more content about this topic.
Thank you!
Thank you!!
Welcome!
You're My MAN :) OSSOM!
Thank you! đđ
Great video. Thanks.
I have discovered that running an image using a Dockerfile from Docker Hub, with only the '-d' flag, does not always create a container that stays up and running. I've had to run the image with '-dit' to create the container(s).
Also, some images don't run to create the container if a command (CMD in Dockerfile) is missing.
This is Great..
Your are too good for beginner
Clear and concise. Though I couldnât get intellisense to work with the FROM command. Where your video has intellisense suggesting available repos after the FROM command.
This is an interesting video I must say. Interested in how images are being pushed to the container registry and Azure app services.
I was just about to start a course on udemy for docker, I feel I can avoid 4+ hours in that course with this one video of yours. Now if you could make one like this for docker swarm or kubernetes it would be amazing.
swarm and kubernetes are completely different, I propose to start with swarm if you want to make some high availability between your home services and few physical machines
Id like to see you do a tutorial of windows docker containersâŠit seems to be entail a lot more tedious set up to actually run themâŠand Iâm curious as to what their use cases might be
Thx!
Great video. What i would liked to see is how can you integrate other things like keepalived into this or any other base image to be up to date always automatically , let it be the base iamge or keepalived while retaining the config files.
Thank you!
Hi techno tim. I love all your videos. Can you please make a video on creating docker swam and deploying traefik and portainer on it?
Very informative. Thank you.
2 Questions,
1. how you knew that html file should be in that path without inspecting the live image?
how can "we" know where to put our files in our base images?
2.Can you please make a docker-compose out of this docker file?
Thanks again
2. is in the docs, already created a compose file that will build this local image for you!
Really good tutorial. Following along nicely.
How do you know what the default command is for a base image?
I think you have to look at that base image. Most of the time I think itâs nothing. Thank you!
Tnks!