Docker Build
Build a docker container with Apache
docker build command is used to create a docker image from Dockerfile.
To create an image, first lets create a working directory and change to the directory.
mkdir ~/my-docker-image cd ~/my-docker-image
Create a file with name Dockerfile
vi Dockerfile
Put following content in it
FROM ubuntu:18.04 RUN apt update && apt upgrade -y CMD ["/bin/bash"]
Now build the docker image with
docker build -t my-ubuntu .
This will create a docker image with name “my-ubuntu”.
To run this, we need to create a container using this image, this can be done with command
docker run -ti my-ubuntu
Here i used -ti as we need to run interactively using terminal, this is because our the command we set to start is “/bin/bash” in the Dockerfile.