The "docker run" command allows you to instantiate a container from an image. That means you can easily create an instance of an application, server or microservice.

Here's a quick visual guide:

#docker
Here's the general format of the command:
The output from "docker run" gives you the unique ID of the container. Seeing such output means your microservice started successfully.

You can use the ID later to stop your container or open a shell into it.
More points to note are:
- The -d argument causes the container to run in detached mode. This means it is running in the background & we can’t directly see its logs. If we omitted this it would be running in the foreground & we’d see it’s output directly, but it would also be tying up our terminal.
- The -p argument binds the port between the host operating system & the container. This is like port forwarding, in that network traffic that is sent to port 3000 on our development workstation is forwarded to port 3000 inside our container.
- The last argument is video-streaming which is the name I gave the image. This is how we specify which image (we could have many) will be instantiated.
Here is the general format for the run command:

docker run -d p <host-port>:<container-port> <image-name>

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Ashley Davis

Ashley Davis Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ashleydavis75

7 Jan
Yesterday I posted some of the amazing graphics that @ManningBooks have done for my book Bootstrapping Microservices!

Today I show you some examples of how awesome the code listings are with annotations rendered in their final form...

👇
@ManningBooks A simple Node.js microservice:

#nodejs #microservice Image
@ManningBooks Adding a microservice to your Docker-Compose file:

#microservice #docker Image
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!