Docker compose tutorial for beginners by example [all you need to know]

Поделиться
HTML-код
  • Опубликовано: 7 фев 2025
  • You can find the related Docker Compose tutorial blog post with the sample code her: takacsmark.com...
    This Docker Compose tutorial video explains the following points:
    What is Docker Compose
    Compose file basics
    Preparing the example
    requirements.txt
    app.py
    Dockerfile
    Adding the Docker Compose file
    Run the example
    How are the containers connected
    Working with the Compose file
    The Docker Compose file reference
    Docker Compose vs Swarm
    The structure of the Compose file
    Service configuration options
    Build configuration
    Runtime configuration
    Deployment options
    Work with Docker Compose in your projects
    Compose CLI
    Build images with Docker Compose
    Use build arguments
    Manage multi-container applications
    Execute commands in a running container
    Run one-off commands
    Ship your multi-container applications
    The concept of desired state
    Scale a service with Compose
    Docker Compose networks
    Volumes and Compose
    Use env_file to pass environment variables
    Variable substitution
    Override the Compose file
    Docker Compose in production

Комментарии • 111

  • @santhoshnagarajs3489
    @santhoshnagarajs3489 6 лет назад +7

    If anyone gets this error redis.exceptions.DataError: Invalid input of type: 'dict'. Convert to a byte, string or number first
    change the requirements.txt use redis==2.10. instead of redis

    • @takacsmark
      @takacsmark  6 лет назад

      Thanks Santosh, indeed redis-py has changed, the example is broken with the new version.

    • @santhoshnagarajs3489
      @santhoshnagarajs3489 6 лет назад

      @@takacsmark Thank you for the video. It is very useful.

    • @marouane55
      @marouane55 6 лет назад +1

      @@santhoshnagarajs3489 In requiretements.txt change redis to redis

    • @koodauskanava9096
      @koodauskanava9096 5 лет назад +1

      You can just serialize your dict with json.dumps(data) when you store data and unpack it when you read data with json.loads(item)

    • @renetoby234
      @renetoby234 3 года назад

      i dont mean to be off topic but does anybody know of a method to get back into an instagram account??
      I somehow forgot my password. I would love any help you can give me

  • @kipitrash9403
    @kipitrash9403 4 года назад

    Sorry if this is a weird compliment, but you are very good at making eye contact with the camera. It makes the tutorial feel more personal

  • @markostojiljkovic7100
    @markostojiljkovic7100 4 года назад +1

    Great video, its sad that videos like this dont receive many views, but content like this is just not for wide audiences

  • @nishantkumar5949
    @nishantkumar5949 4 года назад

    The best docker compose lecture I have ever found !!! Thank you !!! I don't understand who are those people who have pressed disliked button. This is best video one can get for understanding the docker-compose ecosystem...

  • @dc56271
    @dc56271 6 лет назад +2

    This is such an outstanding tutorial precisely because it provides an in-depth walkthrough of the subject without being overwhelming or running off on tangents. It deserves 100 times the views it has. Well done.

  • @quangluong5413
    @quangluong5413 4 года назад +3

    The explanation is amazing. I've been wandering around different Docker Compose tutorials but I have got the best idea out of this video. Keep up the good work and thank you!

  • @dmytroshchotkin2939
    @dmytroshchotkin2939 2 года назад

    I wish there were a video about 'networks' explained by you. That would be awesome.

  • @ruirodrigues705
    @ruirodrigues705 4 года назад +1

    best docker-compose tutorial i ever saw... thanks for all the information... :)

  • @aashayamballi
    @aashayamballi 4 года назад

    The way you teach with the smile on your face always is really great to watch! Thank you for this tutorial 😊

  • @gagangupta1255
    @gagangupta1255 5 лет назад +3

    One of the best and the easiest docker compose tutorial on web. Keep up the good work

  • @chukwuemekaajima8373
    @chukwuemekaajima8373 4 года назад

    This video is so underrated, the best course on docker compose I have taken. I am in 2020 and this crash course virtually thought me about things I have been using without prior proper understanding.

  • @askariBLT1989
    @askariBLT1989 6 лет назад +1

    It is a most thorough and easy to understand tutorial on docker-compose that I've found on RUclips. Keep up the good work!!!!!!!!

  • @GonzaloOviedoLambert
    @GonzaloOviedoLambert 4 года назад

    Congratulations!, The first one in internet who explain so well docker-compose. Fantastic. Thank you. After hours of searching.

  • @asntube1
    @asntube1 5 лет назад +1

    The best docker-compose video tutorial that i have found. Congratulation!!!

  • @wildanimalisandveryfunnyfa6324
    @wildanimalisandveryfunnyfa6324 4 года назад

    You should be creating more videos because you really know how to transfer knowledge. Great video

  • @aashayamballi
    @aashayamballi 4 года назад

    The way you teach, with the smile on your face is really great 😍

  • @aisonnet
    @aisonnet 6 лет назад +1

    As a learner, I loved your explanation. Really appreciated.

  • @superawesh
    @superawesh 5 лет назад +5

    already liked after watching 8 mins of content, MOST AMAZING DOCKER TUTORIAL WITH IN 50 MINS. TOTALLY WORTH SPENDING 50 MINS 👍 thanks #DockerExpert

  • @agentpx
    @agentpx 4 года назад

    I seldom comment, but this is the best docker-compose tutorial I have ever watch. Keep up the good video coming. subs :D

  • @phlo2009
    @phlo2009 4 года назад

    This is a very informative tutorial for beginners. Thanks for the good work.

  • @dsmolero
    @dsmolero 6 лет назад

    Thank you very much! Kudos to you Mark! You impart knowledge very systematically and very clearly. -- from the Philippines.

  • @doctorread1
    @doctorread1 4 года назад

    Thank you so much for the video. Just the right amount of detail and great pace. Clearly explained some concepts I'd just taken for granted. I've subscribed and look forward to learning more.

  • @nomenetasaili7339
    @nomenetasaili7339 5 лет назад +4

    Thankyou, was trying to get my head around docker compose and this helped a lot

  • @darrylmalcaba39
    @darrylmalcaba39 3 года назад

    Great video. I learned a lot in this tutorial. I appreciate you putting this all together!

  • @NaveenBavuOfficial
    @NaveenBavuOfficial 3 года назад

    Awesome vedio sir..I learnt what I need, keep doing the good work.

  • @matmccann
    @matmccann 5 лет назад

    Best docker-compose tutorial out there. Thank you so much!!

  • @WaldirBorbaJunior
    @WaldirBorbaJunior 4 года назад

    Amazing content. Thank you for sharing.

  • @miles-levoit
    @miles-levoit 6 лет назад +6

    wow, so informative. That was world class! Merci beaucoup mon ami

  • @the-raj-verma
    @the-raj-verma 3 года назад

    Simply awesome, Thanks for the effort :)

  • @user-zk1im8he5j
    @user-zk1im8he5j 5 лет назад +1

    with my broke english i understood almost everything ! Best explication !!!! Thanks a lot!

  • @aungmyint889
    @aungmyint889 3 года назад

    Excellent!. Thank you so much.

  • @krishm5116
    @krishm5116 4 года назад

    Awesome tutorial, I wish to have you as my Team lead.

  • @chikosan99
    @chikosan99 5 лет назад +1

    Thanks a lot for your time ! Love your video

  • @pradipspeaks9395
    @pradipspeaks9395 3 года назад

    Excellent 🙏 Thanks a lot. 👍

  • @jayaprakashdeav
    @jayaprakashdeav 5 лет назад

    Very neat explanation, loved it !!!

  • @sagimor8646
    @sagimor8646 4 года назад

    Great guide, thank you.

  • @AshisRaj
    @AshisRaj 3 года назад

    Fantastic explanation

  • @rinav4all
    @rinav4all 6 лет назад

    Thank you for the amazing series of tutorials along with followup blog. It's pretty handy and useful

  • @MrAbhilashsv
    @MrAbhilashsv 5 лет назад

    What a nice explanation! WOW! WOW! WOW! like the way of teaching.. Thanks a lot Mark! Happy Christmas! #Docker Expert

  • @villamkecske6503
    @villamkecske6503 4 года назад

    Nice tutorial, keep up the great work, Márk! :)

  • @venkateshjavaji2875
    @venkateshjavaji2875 5 лет назад

    One of the best on docker-compose!! Tq

  • @kailashdim7560
    @kailashdim7560 6 лет назад

    Thanks for such a good video and explaining everything which is required.

  • @santoshsahani2129
    @santoshsahani2129 6 лет назад

    Nice tutorial on docker compose. Thank you !!

  • @vivekraj5071
    @vivekraj5071 6 лет назад +2

    Very good, Please do upload videos on swarm.

  • @foobar1231
    @foobar1231 6 лет назад

    Excellent tutorial. Thank you!

  • @JigneshPatel-bw5pq
    @JigneshPatel-bw5pq 5 лет назад

    Thanks Mark, It is very hepful tutorial.....

  • @MohsenKAmini
    @MohsenKAmini 3 года назад

    That was awesome thank you :)

  • @stevenleonmusic
    @stevenleonmusic 3 года назад

    I used Docker Compose to setup a LAMP environment but MySQLi isn't installed by default so I had to create a DockerFile and run some Bash commands to install MySQLi and commit it to the container. Is there a way to take this new environment I have with LAMP + MySQLi and export that so I can share it with the rest of the team?

  • @justlstn
    @justlstn 6 лет назад

    Thank you so much for a video. It's very helpful

  • @notpublic7149
    @notpublic7149 6 лет назад

    Sir, if you are not a professor, you should be... Cheers for the information mate. Crazy useful!

    • @takacsmark
      @takacsmark  6 лет назад +1

      Thanks, this is one of the funkiest comments that I got :)

  • @gabrielmarrocos8993
    @gabrielmarrocos8993 5 лет назад

    Great video! Thanks!

  • @Bargains20xx
    @Bargains20xx 5 лет назад +1

    Thank you so much for this

  • @pot8778
    @pot8778 3 года назад

    I would like to ask you if you have any plans about preparing new tutorial series related with K8s?
    by the way your Videos about Docker are great, thanks

  • @dontlogin79
    @dontlogin79 4 года назад

    Thanks for this awesome tutorial!! Just curious, what editor/ide are you using?

  • @abdulmateenmohammed7103
    @abdulmateenmohammed7103 6 лет назад

    Excellent Mark, thanks a tonne :-)

  • @veryshafrudin3490
    @veryshafrudin3490 5 лет назад

    great job bro. nice tutorial

  • @koustavbanerjee9533
    @koustavbanerjee9533 6 лет назад +1

    Thank you so much for this introductory video.Could you also upload some more advanced videos as well in sequence to this?

    • @takacsmark
      @takacsmark  6 лет назад

      Hi Koustav, thanks for your feedback. What advanced topic would you like to be covered?

    • @koustavbanerjee9533
      @koustavbanerjee9533 6 лет назад

      @@takacsmark Hi takacsmark, Could you demonstrate deployment of slightly more complex applications using docker compose and swarm?

  • @santhoshkumarkasarla
    @santhoshkumarkasarla 6 лет назад

    Thank you nice video please upload other videos

  • @ZaheeruddinBabur8
    @ZaheeruddinBabur8 5 лет назад

    Awesome tutorial

  • @sudhansupradhan6891
    @sudhansupradhan6891 5 лет назад

    Great Tutorial !!!

  • @pramodkumar-hi3hn
    @pramodkumar-hi3hn 5 лет назад

    Thanks a lot

  • @gopalkrishnan7208
    @gopalkrishnan7208 4 года назад

    Excellent

  • @denizevsen6938
    @denizevsen6938 5 лет назад

    thanks for this helpful tutorial :)

  • @TellaTrix
    @TellaTrix 6 лет назад

    Seems you are pretty docker guy... Nice content.

  • @neotodsoltani5902
    @neotodsoltani5902 3 года назад

    Hi, thanks for the video.
    In your Dockerfile you first copied the "requirements.txt" file and then installed the packages with pip. After that you copied all of your local files and directories into your container.
    Why not first copying all of the local files and directories into the container app directory and then install python packages with pip install -r "requirements.txt"?
    Is there any trick or something with doing that?

  • @mahimainathansowrirajan2551
    @mahimainathansowrirajan2551 5 лет назад

    Its Great Tutorial!

  • @aftabbaig8758
    @aftabbaig8758 5 лет назад

    Great tutorial @takacsmark. Do you've any knowledge of why we use `mutagen` with docker. Any pointer would be helpful. Thanks

  • @amitjain561
    @amitjain561 6 лет назад

    If I am scaling service with a factor of 5 on tree node cluster then definitely the same service deployed multiple times on the same node. My question is related to dynamic port allocation, in service definition if we have configured - 8080:80 which means that internal container port is mapped to external port 80. How do we handle such scenario I assume that there will problem in replicating the same service if that service already running on the same node because port 80 is already in use. I am sorry if you have already covered such use case in your video. Many thanks, Mark for your wonderful work.

    • @takacsmark
      @takacsmark  6 лет назад

      Hi Amit, if you are on a cluster, you need a container orchestrator like Docker Swarm or Kubernetes. Comopse is single host only. I'm writing my Swarm tutorial right now, but it's not yet ready :) You can buy my book though, to get started, or you can check out the only documentation of Swarm or Kubernetes. Swarm is built into Docker, so I would suggest to start with that. Scheduling, scaling and service discovery are all built in, so Swarm can cover your scenario. If you need application level load balancing, then you need to add a load balancer yourself to your deployment.

    • @amitjain561
      @amitjain561 6 лет назад

      @@takacsmark Ok got you Swarm or Kubernetes need for deploying services on a multinode cluster. Is there any way to avoid a port collision when running service replica on a single node using docker-compose command?

    • @takacsmark
      @takacsmark  6 лет назад

      @@amitjain561 You can add a reverse proxy to your compose file and map it to port 80, a good docker image is github.com/jwilder/nginx-proxy.

  • @binnihh
    @binnihh 6 лет назад

    You are awesome!

  • @kevinkkirimii
    @kevinkkirimii 3 года назад

    Hi Mark, I am just wondering doesn't using the service name defined in the compose file as your host name in your app db connection tightly couple your application to docker ? What if you wanted to migrate to a different container like openshift ?

  • @filipvanreeth
    @filipvanreeth 6 лет назад

    Hi cool video. Which vs code theme are you using. Looks like a nice one

    • @takacsmark
      @takacsmark  6 лет назад

      Hi, that's the Quiet Light theme, that's built into vscode. I moved on the Dracula in the meantime, btw. :)

  • @dineshcondur
    @dineshcondur 4 года назад

    Thanks for sharing very informative! I spy Terraform extension 👀. I will be interested to look for something like this video on Terraform if possible.

  • @amitjain561
    @amitjain561 6 лет назад

    Mark great work - hats off for you. I have one doubt when you dropped compose file on play-with-docker server what happened to Dockerfile referred in compose file?

    • @takacsmark
      @takacsmark  6 лет назад +2

      Good question, this is an important point. When we drop the compose file to the server, we will use the image that is specified in the compose file. What happens is that docker-compose will pull the image from the Docker hub and it will NOT build it from the Dockerfile. This is possible, because we pushed our image previously to the Docker hub. This implies that we do not need to drop the Dockerfile to the server, we are not building the image on the server, we pull the image from the HUB. This is important, because this is how you should do it on a real project. Build the image, push it to a registry and pull it on your server. Your deployment entity is the image, not the Dockerfile.

    • @amitjain561
      @amitjain561 6 лет назад

      @@takacsmark Thanks Mark for swift response and making more clear :)

  • @humanfirst11
    @humanfirst11 4 года назад

    I want to know what keyboard are you using please?

    • @takacsmark
      @takacsmark  4 года назад

      Hi, I'm using this one www.coolermaster.com/catalog/peripheral/keyboards/quick-fire-xt/

  • @VinayKumar-pi4wm
    @VinayKumar-pi4wm 6 лет назад

    good one

  • @hilalaiss
    @hilalaiss 4 года назад

    i need some help in docker containers and kafka

  • @ogulcankarayel5625
    @ogulcankarayel5625 4 года назад

    How can I deploy it to the heroku ?

  • @amitjain561
    @amitjain561 6 лет назад

    Docker Compose composes of different services. How could we manage dependency among them for e.g. my spring application can't boot without MySQL and if docker starts deploying spring app first then it definitely gonna fail do we have someway with docker compose to tackle corner case?

    • @takacsmark
      @takacsmark  6 лет назад

      Hi Amit, thanks for the great question. You can add `depends_on` to the services in the Compose file to define if a service depends on an other service. Docker will make sure that the containers will be started in dependency order. This will, however not make sure that the service (like a db) is also ready to receive connections. Since every dependency is different, you have to do the check manually. You can write a shell script and add it to your ENTRYPOINT or CMD in the Dockerfile that checks if the db is ready and start up the depending server after. You can read more about this here docs.docker.com/compose/startup-order/.

  • @thrivenithrives2303
    @thrivenithrives2303 5 лет назад

    How to share a single terminal between two or more containers for printing data parallelly

    • @takacsmark
      @takacsmark  5 лет назад

      Hi Thriveni, using docker-compose up will automatically print the standard output of all containers to your terminal.

    • @thrivenithrives2303
      @thrivenithrives2303 5 лет назад

      @@takacsmark but I need to up the all containers parallel not to sequencially

    • @thrivenithrives2303
      @thrivenithrives2303 5 лет назад

      Thank you for your reply but in the case of docker compose up it runs the containers one by one but I want to up all containers simultaneously

    • @takacsmark
      @takacsmark  5 лет назад

      What are you trying to achive exactly? Compose will start up a container for every service in the compose file. They will all start up after you issue the command. They start up one by one, but compose manages them together. What's your use case?

    • @thrivenithrives2303
      @thrivenithrives2303 5 лет назад

      @@takacsmark In my case one container need to print hello-world continuously and another container need to print like thriveni for random time at the time of first container running after random time it need to switch to second container and after completing the printing of second container again it need to trigger the first container like that need to switch containers from one to another.It is like the two containers were sharing the terminal

  • @junaid45678
    @junaid45678 6 лет назад +1

    You are great. Could you please improve the sound quality of your videos? It's not only very low but also a bit of drum effect is present.

    • @takacsmark
      @takacsmark  6 лет назад

      Thanks, I will look into sound definitely, I got comments on the loud keyboard, too.

  • @pareenvatani9460
    @pareenvatani9460 5 лет назад

    Super like :-)

  • @dota2gammingfun93
    @dota2gammingfun93 5 лет назад

    So many advertisement dude ... video is good

  • @jdotsystem
    @jdotsystem 4 года назад

    Just tutorial for beginner
    Wordpress has weak point to connect to database directly without WEB API
    If you talk Docker compose it is better way to use local network in Docker
    Wordperss is END of Cotnents also PHP

  • @kosmaspalios1768
    @kosmaspalios1768 5 лет назад

    woooop 18:38

  • @aashayamballi
    @aashayamballi 4 года назад

    The way you teach, with the smile on your face is really great 😍