https://docs.docker.com/engine/reference/builder ARG USER=defaultuser FROM centos:latest ENV USER=${USER} RUN yum -y install httpd ENTRYPOINT ["/usr/bin/htpasswd", "-c", "/htpasswd"] CMD ["USER"]