When enter the command in powershell I get this error
“invalid argument “Dockerfile2**” for “-t, –tag” flag: invalid reference format: repository name must be lowercase
See docker build --help.
The Dockerfile I created is in word but I saved it as a plain text.
This is what I typed in my Dockerfile.
FROM centos:7
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i ==
systemd-tmpfiles-setup.service ] || rm -f $i; done);
rm -f /lib/systemd/system/multi-user.target.wants/*;
rm -f /etc/systemd/system/*.wants/*;
rm -f /lib/systemd/system/local-fs.target.wants/*;
rm -f /lib/systemd/system/sockets.target.wants/*udev*;
rm -f /lib/systemd/system/sockets.target.wants/*initctl*;
rm -f /lib/systemd/system/basic.target.wants/*;
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]
3
Answers
You are tagging your docker image as “Dockerfile2”.
You can’t use the Upper case letter for tagging your docker file.
change -t parameter from “Dockerfile2” to “dockerfile2” while building docker image.
Based off the error message, when naming tags, you have to have them in lowercase.
Try changing “Dockerfile2” in your command to the all lowercase: “dockerfile2”
Please do the following in order to be able to build it successfully using Powershell:
In my environment, your file was built successfully but there was a warning regarding one of your command in your Dockerfile entries:
[WARNING]: Empty continuation line found in:
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in ; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); rm -f /lib/systemd/system/multi-usemd-tr.target.wants/;rm -f /etc/systemd/system/.wants/;rm -f /lib/systemd/system/local-.getmpfiles-setup.servifs.target.wants/; rm -f /lib/systemd/system/sockets.target.wants/udev; rm -f /lib/..wa/systemd/system/.wa.wants/;rm -f /lib/systemd/system/anaconda.target.wants/*; tm/sts.target.wants/ude
[WARNING]: Empty continuation lines will become errors in a future release.