Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9



In this Docker Compose Tutorial you will learn what Docker Compose is, why it’s useful and how to use it.
► Subscribe to me on Youtube: https://bit.ly/2z5rvTV

Docker Compose is a tool that makes running multiple Docker containers much easier, than with Docker run commands. I show you how docker run command compares to a docker compose file and explain step by step the difference and how it maps from docker run to a docker compose field.

So, basically you can take the whole docker run command with it’s configuration and map it into a file. You will get a more structured and re-usable command, especially if you have e.g. 10 docker containers.

▬▬▬▬▬▬ T I M E S T A M P S 🐳
0:00 – Intro
0:07 – What is Docker Compose?
1:22 – docker run commands VS docker compose
5:05 – How to use it? – Create the Docker Compose File (Demo)
7:25 – Docker Networking in Docker Compose

#devops #techworldwithnana #docker #dockertutorials
———————————————————————————————————–

Once you’ve learnt the basic concepts, it’s important to see how Docker is actually used in practice or in real world development so to say.
In the next few videos “Docker in Practice” I want to show you exactly this:
Developing with Docker ► https://youtu.be/6YisG2GcXaw
Docker Compose ► https://youtu.be/MVIcrmeV_6c
Dockerfile ► https://youtu.be/WmcdMiyqfZs
Private Repository ► https://youtu.be/vWSRWpOPHws
Deploy your containerized Application ► https://youtu.be/ZowjOhpAcIc

You can check out my videos for the Pre-Requisites:
✅ Basic Docker Concepts: https://youtu.be/GeqaTjKMWeY
✅ Basic Commands: https://youtu.be/xGn7cFR3ARU

For any questions/issues/feedback, please leave me a comment and I will get back to you as soon as possible.

►► Full Docker and Kubernetes Tutorial Playlist: https://bit.ly/2YGeRp9
This video is the 9th of a complete series for beginners.

💡 Only interested in Docker?
►► Complete Docker Tutorial Playlist: https://bit.ly/2ymJHbX

#docker #whatisdocker #dockertutorials #devops #techworldwithnana
————————————————————————————-

The complete step-by-step guide to Docker and Kubernetes will include the following content:

🐳 D O C K E R
– Container concept
– Why docker? (image vs. traditional DevOps)
– Install docker on different operating systems
– 8 basic commands you need to know
– Docker vs. Virtual Machine
– Docker in Practice: Overview of whole development process with Docker (development, continuous delivery, deployment)
– Develop an application with Docker
– Docker Compose
– Dockerfile
– Private Repository
– Deploying your containerized application
– Docker Volumes from theory to practice

✵ K U B E R N E T E S
– Main Kubernetes components (including Pod, Service, Ingress, Volumes, ConfigMap, Secrets, Deployment, StatefulSet)
– Kubernetes architecture for beginners (master, slave nodes & processes)
– Understand how does K8s REALLY work? Main Concepts of how to use K8s
– Minikube, Kubectl – set up the cluster and connect to it
– Kubectl main commands – Demo
– Configuration file (YAML) – syntax
– Kubernetes Namespaces
– Communication between the pods – basic networking concepts in Kubernetes
– K8s Deployment in practice – example application deployment (pod + service + Ingress + secret)

▬▬▬▬▬▬ Connect with me 👋 ▬▬▬▬▬▬
Join private Facebook group ► https://bit.ly/32UVSZP
Don’t forget to subscribe ► https://bit.ly/3mO4jxT
DEV ► https://bit.ly/3h2fqiO
INSTAGRAM ► https://bit.ly/2F3LXYJ
TWITTER ► https://bit.ly/3i54PUB
LINKEDIN ► https://bit.ly/3hWOLVT

Legal Notice:
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein. This video is not accredited, certified, affiliated with, nor endorsed by Docker, Inc.

source

42 thoughts on “Docker Compose Tutorial – Docker in Practice || Docker Tutorial 9”
  1. Hey Nana after trying to the apply the same fields on docker compose file I got an error, then I fixed the file as below:
    version: '3'
    services:
    mongo:
    image: mongo
    ports:
    – 27017:27017
    environment:
    – ME_CONFIG_MONGODB_ADMINUSERNAME=admin
    – ME_CONFIG_MONGODB_ADMINPASSWORD=admin

    mongo-express:
    image: mongo-express
    restart: always
    links:
    – mongo
    ports:
    – 8080:8081
    environment:
    – ME_CONFIG_MONGODB_ADMINUSERNAME=admin
    – ME_CONFIG_MONGODB_ADMINPASSWORD=admin

  2. I absolutely love your tutorials, Nana. I've come into a problem though, where mongo spews out logs in plain text which is very difficult to read. Any idea on how to overcome that? Thanks in advance!

  3. Once again Nana has put together another absolutely brilliant video. I have learned more about Docker from her than any other source. She has a wonderful talent for explaininng concepts clearly and compreshensively.

    Keep up the good work Nana, what you do a a wonderful gift to developers all over the world. 🙂

  4. You have to show us how you set up the collection for users so that we can follow through everythinggggg

  5. If you have a couple of services that you are running (not as part of your own built apps) is it good convention to split them up into individual docker compose files or have them all as one? Also, where should docker compose files go?

  6. I like how clear, straightforward and easy to understand you make this. It makes me think you have a really good understanding of how this works! Thank you

  7. Hello,

    I followed your method in creating a .yaml file. The mongodb container runs but mongo-express runs for few seconds and then stops. When I start mongo-express, it runs, however, I am not able to access it via web browser. On checking the logs I got the following message:

    Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

    (node:8) UnhandledPromiseRejectionWarning: MongoError: command listDatabases requires authentication

    at Connection.<anonymous> (/node_modules/mongodb/lib/core/connection/pool.js:453:61)

    at Connection.emit (events.js:314:20)

    at processMessage (/node_modules/mongodb/lib/core/connection/connection.js:456:10)

    at Socket.<anonymous> (/node_modules/mongodb/lib/core/connection/connection.js:625:15)

    at Socket.emit (events.js:314:20)

    at addChunk (_stream_readable.js:297:12)

    at readableAddChunk (_stream_readable.js:272:9)

    at Socket.Readable.push (_stream_readable.js:213:10)

    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

    (node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `–unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

    (node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise

    rejections that are not handled will terminate the Node.js process with a non-zero exit code.

    On other forums too, the solution provided are not working for me.

    Did you also encounter such errors with other container deployment ??

    Many thanks.

  8. 147 / 5.000

    Risultati della traduzione

    Hello,

    I did not understand how to set up the volumes for the docker-compose.yml, could you indicate where to study them?

    thank you very much for your videos.

  9. Mam trust me u r clearing all the concepts which i was struggling to understand for such a long time..thank u soo much..

  10. here we don't need to specify the port mapping for mongo, I don't see why we map it, between containers in same network, there is no need ….

  11. Great tutorial series!
    Adding "restart: always" to the mongo-express part of the yaml fixed a start-up error for me where mongo-express would exit if mongo wasn't ready for it.

  12. The mongo-express container stops running during the initial run and needs to be manually started. I think mongo-express needs start needs to be delayed to ensure mongodb container is up first.

  13. Hi Nana, i have a question. Why is it forwarding to port 8081? As you said in the yaml file it it 8080:8080.

  14. Thank you for this great intro – helps me to immensely wrap my head around something I am picking at work. I was wondering if you could help understand what context means within a compose file? Seems to me like a pointer to another dockerfile? Many thanks

  15. Thank you so much great tutorials series, I have tried to work for myself, but facing an issue with the mongo express. Suppose I have run the express with port 8081 not working a second time with the same port, Any suggestion for the same?

  16. When mongo-express fails to run… :
    Add this to the mongo-express service:
    restart: always
    depends_on:
    – mongodb

    Edit: Well it seems that the ME_CONFIG_MONGODB_ENABLE_ADMIN=true is not working either in the latest version…
    So actually the best solution is to refer to mongo-express:0.54 instead of latest:
    image: mongo-express:0.54

  17. What is "context" in a docker compose?
    I get an issue with a copy command saying the file isn't there while it is. Lets say in ./schema.sql
    Context is set to .

    Cant up compose it says rpc error, file not found. Can you please help?

  18. Why didn't you name the file 'docker-compose.yaml'? Then you can omit giving a file name to docker-compose like '-f mongo.yaml'.

  19. Hi Nana,
    Thanks for the awesome vid. I have a pretty specific question. What is the best standard to follow for the given situation:

    – I have a dockerfile in one GitHub repo
    – 2nd dockerfile in another GitHub repo

    What’s the best practice to follow when I want both of these remote dockerfiles to be included in the same yaml but want to not just spin up both containers thru docker-compose yaml, but also rebuild each remote dockerfile with using the latest code base from each dockerfile’s respective remote repo.

    Locally, I understand this can be done using: docker-compose up – – build

    But how can I achieve this to only rebuild each individual image from their respective remote GitHub repo dockerfile based on the REMOTE GitHub repos code base?

    I know that’s a lot but would really appreciate your input! Keep up these videos btw super helpful 😁 thanks!

  20. When I am trying to run docker-compose then my mongo-express is not running. Has anyone else face this same issue? mongo-express_1 | Welcome to mongo-express
    mongo-express_1 | ————————
    mongo-express_1 |
    mongo-express_1 |
    mongo-express_1 | (node:7) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
    mongo-express_1 | Could not connect to database using connectionString: mongodb://admin:password@mongodb:27017/"
    mongo-express_1 | (node:7) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongodb:27017] on first connect [Error: connect ECONNREFUSED 172.23.0.2:27017
    mongo-express_1 | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
    mongo-express_1 | name: 'MongoNetworkError'
    mongo-express_1 | }]
    mongo-express_1 | at Pool.<anonymous> (/node_modules/mongodb/lib/core/topologies/server.js:438:11)
    mongo-express_1 | at Pool.emit (events.js:314:20)
    mongo-express_1 | at /node_modules/mongodb/lib/core/connection/pool.js:562:14
    mongo-express_1 | at /node_modules/mongodb/lib/core/connection/pool.js:995:11
    mongo-express_1 | at /node_modules/mongodb/lib/core/connection/connect.js:32:7
    mongo-express_1 | at callback (/node_modules/mongodb/lib/core/connection/connect.js:280:5)
    mongo-express_1 | at Socket.<anonymous> (/node_modules/mongodb/lib/core/connection/connect.js:310:7)
    mongo-express_1 | at Object.onceWrapper (events.js:421:26)
    mongo-express_1 | at Socket.emit (events.js:314:20)
    mongo-express_1 | at emitErrorNT (internal/streams/destroy.js:92:8)
    mongo-express_1 | at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    mongo-express_1 | at processTicksAndRejections (internal/process/task_queues.js:84:21)
    mongo-express_1 | (node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `–unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    mongo-express_1 | (node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

  21. You explained docker-compose better than anyone else, you make it crystal clear

  22. I have faced with this problem:
    ERROR: In file '.mongo.yaml', service 'ports' must be a mapping not an array.
    what can i do?

  23. Amazing really u first explained the commands to create images and networks and then u introduce the yaml file it just hit the sweat spot on my brain thanks for this amazing series. <3

  24. I have watched lots of tutorials about docker,docker-compose and volumes then found out she explained everything way better than those i have watched so far.appreciate it

Leave a Reply

Your email address will not be published.

Captcha loading...