报错
使用docker构建镜像时报错:
[root@iZhp33j6fklnmhbf0lz2obZ ~]# docker build -t test:latest
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
解决
复制粘贴时,小心细节,结尾一定要加空格再加点。文章来源:https://www.toymoban.com/news/detail-523685.html
docker build -t test:latest .
[root@iZhp33j6fklnmhbf0lz2obZ ~]# docker build -t test:latest .
Sending build context to Docker daemon 28.76MB
Step 1/7 : FROM ubuntu:22.04
---> df5de72bdb3b
Step 2/7 : RUN apt-get update && apt-get install -y python3 python3-pip
---> Using cache
---> eee89b706a8b
Step 3/7 : RUN pip install flask==2.1.*
---> Using cache
---> d7b00194a3bd
Step 4/7 : COPY hello.py /
---> Using cache
---> eaf08a89e93f
Step 5/7 : ENV FLASK_APP=hello
---> Using cache
---> 981fa111d188
Step 6/7 : EXPOSE 8000
---> Using cache
---> a6ef7a1dc59d
Step 7/7 : CMD flask run --host 0.0.0.0 --port 8000
---> Using cache
---> 90cb9f03bf34
Successfully built 90cb9f03bf34
Successfully tagged test:latest
复制决定成败,细节决定人生。文章来源地址https://www.toymoban.com/news/detail-523685.html
到了这里,关于Docker报错:“docker build“ requires exactly 1 argument.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!