Search Suggest

Create dockerfile for apache webserver

Create directory on local system

# mkdir -p /root/docker-task/apache2
# cd  /root/docker-task/apache2

Create Dockerfile for apache web-server for Ubuntu platform 

# vim Dockerfile

FROM ubuntu:18.04
RUN apt-get update && apt-get install -y apache2 vim
RUN  apt-get install  -y openssh-server

#change working directory to root of apache webhost
WORKDIR /var/www/html

#copy your files, if you want to copy all use COPY . .
COPY index.html index.html

#now start the server
CMD ["apachectl", "-D", "FOREGROUND"]

Run command to create image from Dockerfile
# docker build .

Run command to check docker images
# docker images

Run command to create docker container
docker run -it --name containername image_id

Run command to check running docker container
# docker ps

Run command to check all running and stopped container
# docker ps -a

Login to docker container
docker exec -it apachecon1 bash

Đăng nhận xét