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