docker镜像内容

  1. FROM ubuntu:20.04
  2. RUN apt-get update && \
  3. DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python3.9 python3-pip python3.9-dev
  4. ADD hello.py /
  5. CMD ["python3", "/hello.py"]
  1. print("hello docker")

构建docker镜像命令

  1. docker image build -t hello .

build —构建

t — docker镜像名字

. — 当前的文件下

上传docker镜像

  1. docker login
  2. docker image push heaode/hello:1.0