What is Dockerfile and How to create and build Dockerfile

preview_player
Показать описание
In this video, you will learn what is a dockerfile, how to create it and how to build an image from the dockerfile.

I will demonstrate how to build a docker image from dockerfile using a simple dockerfile example. This is going to be a Docker build and run example, covering complete Docker build example.

Below are some simple yet very useful docker build argument.

Docker Build Command
docker build -t xynetimg:1.0 .
Note that "xynetimg" can be replace with your custom image name, and "1.0" can be replaced with your version of the image.
Note there is a period (.) at the end of the command.

Docker Run Command
Docker command can be rung using the command prompt.
Running Docker using image name
docker run xynetimg:1.0
where "xynetimg" is to be replaced with your custom image name , and "1.0" can be replaced with your version of the image.

Running Docker using image ID.
docker run 6448aee60504
where "6448aee60504" is your image ID

Running Docker with persistence in Docker
docker run -ti --rm xynetimg:1.0
where "xynetimg" is to be replaced with your custom image name , and "1.0" can be replaced with your version of the image.

List Of All Images In The System
docker images

Dockerfile in this demo. A dockerfile is a simple text file which can be created using your notepad or any text editor. Its default name would be "dockerfile" (without filename extension).
FROM ubuntu

RUN apt-get update

CMD ["echo", "Hello World from Xybernetics image...."]

#DockerImages #DockerContainers #DockerTutorials
Рекомендации по теме