Build YOUR OWN Dockerfile, Image, and Container - Docker Tutorial

SdĂ­let
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

Komentáƙe • 237

  • @TechnoTim
    @TechnoTim  Pƙed 2 lety +54

    Have you built your down Docker container yet?

    • @barisgunduz
      @barisgunduz Pƙed 2 lety +2

      Building soon. Thanks again.

    • @lucasdealmeidacarotta3174
      @lucasdealmeidacarotta3174 Pƙed 2 lety +1

      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.

    • @quinnhenry6719
      @quinnhenry6719 Pƙed 2 lety +7

      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!

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety +2

      @@quinnhenry6719 Thank you so much!

    • @Maliuta
      @Maliuta Pƙed 2 lety +1

      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).

  • @kevineugenius
    @kevineugenius Pƙed 2 lety +54

    Thank you so much for NOT starting this with "here's how to download docker, here's how to install docker".

  • @usimian
    @usimian Pƙed rokem +15

    Wow, what a great tutorial. In less than 20 minutes you explained what others would have taken hours. Thank you!

  • @tintincr1
    @tintincr1 Pƙed 3 měsĂ­ci +2

    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!

  • @DFsdf3443d
    @DFsdf3443d Pƙed rokem +9

    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.

  • @Electrowave
    @Electrowave Pƙed 3 měsĂ­ci +2

    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 🙂

  • @MrConcord75
    @MrConcord75 Pƙed rokem +5

    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!

  • @yashsolanki069
    @yashsolanki069 Pƙed rokem +9

    Your teaching style is great!
    Would love to see more from you🙌

  • @TheRagingDonut
    @TheRagingDonut Pƙed 2 lety +41

    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

    • @dastiffmeister1
      @dastiffmeister1 Pƙed 2 lety

      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. 😃

  • @GSquaredOG
    @GSquaredOG Pƙed 2 lety +8

    Great video! Id love to see a similar video detailing containers and storage. Like covering the different options that are available to persist data.

  • @rukbook
    @rukbook Pƙed rokem +2

    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!

  • @denniskluytmans
    @denniskluytmans Pƙed 2 lety +10

    Awesome!! Exactly what I needed. You sir, are a legend

  • @mikekadar3325
    @mikekadar3325 Pƙed 2 lety +1

    Nicely done. Lots of help in one place, with end to end examples, in pretty much no time at all. Thanks!

  • @5urg3x
    @5urg3x Pƙed rokem +3

    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!!

  • @matthewdavis2475
    @matthewdavis2475 Pƙed 21 dnem

    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.

  • @SilentKoala
    @SilentKoala Pƙed 2 lety

    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.

  • @Ericb1957
    @Ericb1957 Pƙed 4 měsĂ­ci

    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!

  • @mikegbow4203
    @mikegbow4203 Pƙed rokem +1

    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.

  • @johnkmoore99
    @johnkmoore99 Pƙed 3 měsĂ­ci

    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!

  • @Shambolicoholic
    @Shambolicoholic Pƙed 2 lety

    Something many of us have wondered about as we install containers 👍 Thanks!

  • @coletraintechgames2932
    @coletraintechgames2932 Pƙed 2 lety +2

    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.

  • @leevandamme
    @leevandamme Pƙed rokem

    @TechnoTim, this is a great tutorial. Thanks for putting this together!

  • @angelosalexiou
    @angelosalexiou Pƙed 2 lety

    Thanks for the video! Maybe the best introductory video for docker!

  • @stefanbogdanovic590
    @stefanbogdanovic590 Pƙed 2 lety +1

    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! 😄

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety +1

      Glad you like them! Thank you so much!

  • @moeintaherkhani7289
    @moeintaherkhani7289 Pƙed dnem

    Best Docker tutorial by Johnny Depp

  • @pedrolopez4555
    @pedrolopez4555 Pƙed rokem

    Clear and concise. Thank you!

  • @Marco-zb7wf
    @Marco-zb7wf Pƙed rokem +1

    Gold standard content. Thank you

  • @Doesntcompute2k
    @Doesntcompute2k Pƙed 2 lety +1

    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.)

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety +1

      Thank you so much! Recommending my channel to friends helps more than you know and I really appreciate it!

  • @Guizm0017
    @Guizm0017 Pƙed rokem

    super easy to follow along and properly explained

  • @AhmetBurakAkay
    @AhmetBurakAkay Pƙed rokem

    High quality video. Thank you.

  • @NazarRud
    @NazarRud Pƙed 2 lety

    Yep, It was simple enough and useful for me. Thanks

  • @McWickyyyy
    @McWickyyyy Pƙed 2 lety

    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

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety

      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!!

  • @ryanbyrne1788
    @ryanbyrne1788 Pƙed rokem

    really great tutorial and just what I needed!

  • @sonnix31
    @sonnix31 Pƙed rokem

    Really very cool explanation. Will be checking out your content. Thanks man!

  • @odysci
    @odysci Pƙed rokem

    Excellent short tutorial on Docker.

  • @shrinidhig3672
    @shrinidhig3672 Pƙed rokem

    had never understood the purpose of .dockerignore... the way you explained is simply superb

  • @dominikbregovic7052
    @dominikbregovic7052 Pƙed rokem

    Your videos are great and they really helped me a lot. Thank you for your effort.

  • @vanopiano
    @vanopiano Pƙed 2 lety +1

    Thank you for this video with explanation

  • @normandrental2695
    @normandrental2695 Pƙed rokem

    This is awesome!! Thank you so much!!

  • @cvought1
    @cvought1 Pƙed 2 lety

    Amazing timing Tim!

  • @domijantas481
    @domijantas481 Pƙed 6 měsĂ­ci

    Fantastic content, greatly explained and so clear. Thank you and keep going. you just have a new subscriber :D

  • @juliensoyer5786
    @juliensoyer5786 Pƙed rokem

    Excellent tutorial thank you !

  • @adjuxnt
    @adjuxnt Pƙed rokem +1

    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!

  • @mirkalaa
    @mirkalaa Pƙed rokem

    great tutorial, thank you ❀đŸȘ„

  • @alexplaytop
    @alexplaytop Pƙed 3 měsĂ­ci

    Techno Tim - you are man and good tutor! THX ALOT!!!

  • @kumarnachiketa1964
    @kumarnachiketa1964 Pƙed rokem

    excellent work, thank you!

  • @Mr.AhmedAlzeidi
    @Mr.AhmedAlzeidi Pƙed rokem

    Hi , this is very useful for me ... thank you very much I'm using this tutorial to improve my self with docker projects ..

  • @niccodev7704
    @niccodev7704 Pƙed 2 lety

    Awesome, that was very clear and easy to follow, thank you 😊

  • @feibels12
    @feibels12 Pƙed 2 lety

    Great video as per usual Tim! I'm developing an IaaS platform for consumer grade hybrid clouds and your videos have helped immensely. Thanks!

  • @hectorherrera4193
    @hectorherrera4193 Pƙed rokem

    Muy buena explicacion... Estoy empezando con dockers y este ayuda mucho. Gracias x compartir

  • @ryheinz9544
    @ryheinz9544 Pƙed 2 lety

    Wow!..Thanks so much for this video! It was the best explanation I have found! I really learned alot!...Thanks again.

  • @betterstack
    @betterstack Pƙed 2 měsĂ­ci

    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 đŸ’Ș

  • @Democracy_Manifest
    @Democracy_Manifest Pƙed 5 měsĂ­ci

    Great tutorial 👏👏👏

  • @danielyrovas
    @danielyrovas Pƙed 2 lety +1

    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.

  • @galnadjar
    @galnadjar Pƙed rokem

    great explanation, very helpfull , like and subscribed

  • @dawid_dahl
    @dawid_dahl Pƙed 2 lety

    Great video, thanks!

  • @cassiuslives4807
    @cassiuslives4807 Pƙed 5 měsĂ­ci

    Thanks, I learned something!

  • @oleksandrburkhan3277
    @oleksandrburkhan3277 Pƙed rokem

    Thank you! I've created my own docker container!

  • @magicmanj32
    @magicmanj32 Pƙed 7 měsĂ­ci

    Thanks Tim, very informative, I cam to learn how to docker build but got alot more useful info ,thanks

    • @TechnoTim
      @TechnoTim  Pƙed 7 měsĂ­ci

      Glad you enjoyed it

  • @grundgaenger
    @grundgaenger Pƙed rokem +1

    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.

  • @Wongmc644
    @Wongmc644 Pƙed 8 měsĂ­ci

    This is great tutorial. Thanks!

    • @TechnoTim
      @TechnoTim  Pƙed 8 měsĂ­ci

      Glad you enjoyed it!

  • @rishikadas9032
    @rishikadas9032 Pƙed 8 měsĂ­ci

    Hi nicely put together in few minutes. Nice...

  • @crateer
    @crateer Pƙed 2 lety

    Great video and flawless presentation skills!
    Instant sub!

  • @andrewsouthern3295
    @andrewsouthern3295 Pƙed 2 lety

    That intro was smooth !

  • @kebab-case
    @kebab-case Pƙed 2 lety

    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?

  • @zachwolf5122
    @zachwolf5122 Pƙed 2 lety

    5 years later and you’re still teaching me đŸ€

  • @traxeonic3600
    @traxeonic3600 Pƙed 2 lety

    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!

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety

      Thank you! Just send them this! :)

  • @griffjrg
    @griffjrg Pƙed 2 lety

    I finally understand it bro yes thank you

  • @TimRubel
    @TimRubel Pƙed rokem

    great video!

  • @lcch9755
    @lcch9755 Pƙed 2 lety

    You just saved my a$$ bro!!! Thanks a lot

  • @ts47920535
    @ts47920535 Pƙed 2 lety

    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.

  • @mohideenabdulkadhar4280
    @mohideenabdulkadhar4280 Pƙed měsĂ­cem

    It is helpful. thank you

  • @wahibakamoulcode
    @wahibakamoulcode Pƙed 2 lety

    really loved ur video

  • @myr3434
    @myr3434 Pƙed 2 lety

    I’m just here to say that the title and title screen on this video are fantastic.

  • @nils.8335
    @nils.8335 Pƙed 2 lety +2

    how do you always know what i'm about to do haha, insane timing

    • @afrosheenix
      @afrosheenix Pƙed 2 lety

      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.

  • @MrDalholm
    @MrDalholm Pƙed 2 lety +1

    Great video Tim..
    Could you perhaps do a follow-up on the CI part?

  • @drjones694
    @drjones694 Pƙed rokem

    Thank you !!!

  • @Ks-oj6tc
    @Ks-oj6tc Pƙed rokem

    Nice explanation

  • @ak_propra
    @ak_propra Pƙed rokem

    Thanks a lot :)

  • @patrickprucha5522
    @patrickprucha5522 Pƙed rokem

    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!!!!

  • @rossbrook9182
    @rossbrook9182 Pƙed 2 lety

    great video

  • @popaemilian
    @popaemilian Pƙed 2 lety

    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.

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety +1

      Thank you! Great explanation!

  • @JonathanRobert23
    @JonathanRobert23 Pƙed 2 lety +1

    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. 😊

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety

      Already did :) czcams.com/video/liV3c9m_OX8/video.html

  • @lawrence1519
    @lawrence1519 Pƙed 2 lety

    Boa thanks man :D i just needed some "how to .. for dummies" :D

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety

      We are all dummies at some point!

  • @ikorbln
    @ikorbln Pƙed 2 lety

    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.

  • @alaaassaf6244
    @alaaassaf6244 Pƙed 2 lety

    Thank you!!

  • @PCMagikHomeLab
    @PCMagikHomeLab Pƙed 2 lety

    You're My MAN :) OSSOM!

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety

      Thank you! 👍👍

  • @longrolstral
    @longrolstral Pƙed 3 měsĂ­ci

    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.

  • @arvinacosta1978
    @arvinacosta1978 Pƙed rokem

    This is Great..

  • @parthasaha9151
    @parthasaha9151 Pƙed rokem

    Your are too good for beginner

  • @benjohnson9747
    @benjohnson9747 Pƙed rokem

    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.

  • @abiodunibrahim3340
    @abiodunibrahim3340 Pƙed rokem

    This is an interesting video I must say. Interested in how images are being pushed to the container registry and Azure app services.

  • @balub778
    @balub778 Pƙed 2 lety +1

    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.

    • @vanopiano
      @vanopiano Pƙed 2 lety +1

      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

  • @D3M0320
    @D3M0320 Pƙed rokem

    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

  • @camaycama7479
    @camaycama7479 Pƙed 2 lety

    Thx!

  • @Krushx0
    @Krushx0 Pƙed 2 lety +1

    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.

  • @lakshminarasimmanv
    @lakshminarasimmanv Pƙed 2 lety

    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?

  • @70shahin
    @70shahin Pƙed 2 lety

    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

    • @TechnoTim
      @TechnoTim  Pƙed 2 lety

      2. is in the docs, already created a compose file that will build this local image for you!

  • @andrewdavies5722
    @andrewdavies5722 Pƙed rokem

    Really good tutorial. Following along nicely.
    How do you know what the default command is for a base image?

    • @TechnoTim
      @TechnoTim  Pƙed rokem

      I think you have to look at that base image. Most of the time I think it’s nothing. Thank you!

  • @eduardodasilvaramos
    @eduardodasilvaramos Pƙed 2 lety

    Tnks!