Publish first microservice
Docker works on Linux, MacOS, and Windows 10. If you are working on Windows, you’ll first need to install WSL2 (the Windows integrated Linux kernel)
1
docker build -t video-streaming --file Dockerfile .
The -t argument allows us to tag or name our image
Here’s the general format for the docker build command:
1
docker build -t <your-name-for-the-image> --file <path-to-your-Dockerfile> <path-to-project>
1
docker run -d -p 3000:3000 -e PORT=3000 video-streaming
The -d argument causes our container to run in detached mode
The -e argument sets the PORT environment variable to 3000
Here is the general format for the docker run command:
1
docker run -d p <host-port>:<container-port> -e <name>=<value> <image-name>
1
docker logs <container-id>
Debuging the container
1
docker exec -it <container-id> bash
The docker tag command has the following general format
1
docker tag <existing-image> <registry-url>/<image-name>:<version>
Here is the general format for docker push
1
docker push <registry-url>/<image-name>:<version>
This post is licensed under CC BY 4.0 by the author.