posaboutique.blogg.se

Yum install docker rhel
Yum install docker rhel













yum install docker rhel

# Updating dependencies, installing Apache and cleaning dnf caches to reduce container size LABEL Remarks="This is a dockerfile example for Fedora system" # Defining a command to be run after the docker is up # Copying setting file & adding some content to be served by apacheĬOPY data/nf /etc/apache2/nf RUN echo "This is a test docker" > /var/www/html/index.html Mentioned below Dockerfile examples for Ubuntu & Fedora, for reference, Ubuntu Dockerfile So these were all the commands that we can use with our Dockerfiles. This will remove the contents when the image is being re-purposed. For example, we have added our own content for the website using the dockerfile but we might not want it to be used for other docker images. ONBUILD command lets you add a trigger that will be executed at a later time when the current image is being used as a base image for another. We can specify USER with RUN, CMD, or with ENTRYPOINT as well. With USER, we can define the user to be used to execute a command like USER dan. We could also use EXPOSE 80/tcp or EXPOSE 53/udp.ĮNV command sets up environment variables, here we have used it to set HOME to /root. But you might have noticed we didn't extract it & that's the one difference ADD & COPY commands have, ADD command will automatically extract the archive at the destination folder.Īlso we could have used ADD in place of copy, “ADD data/nf /etc/httpd/conf/nf “.ĮXPOSE command will open the mentioned port on the docker image to allow access to the outside world.

yum install docker rhel

Here we have used the COPY command to copy nf from the data directory to the default location of nf on the docker image.Īnd we then used ADD command to copy a tar.gz archive to apache's document directory to serve content on the webserver. they are used to copy the files to docker image with one difference. We can also ask it to create a directory or to install some other packages.ĬOPY data/nf /etc/httpd/conf/nfĬOPY & ADD command almost serve the same purpose i.e. Here we have asked RUN to update our system & then install apache on it. Now RUN command is responsible for installing or changing the docker image as we see fit. We can add a number of labels but it's recommended to avoid unnecessary labels. They are used to pass information like the Maintainer of the docker image, Version number, purpose, or some other remarks. LABEL Remarks="This is a dockerfile example for Centos system"īoth fields MAINTAINER & LABEL Remarks are called labels.















Yum install docker rhel