创建第一个镜像

master
barney 1 year ago
parent c17312d912
commit ee8bdc2fef
  1. 8
      docker_tutorial.code-workspace
  2. 2
      python/.dockerignore
  3. 8
      python/Dockerfile
  4. 1
      python/hello.py

@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

@ -0,0 +1,2 @@
__pycache__
env

@ -0,0 +1,8 @@
# 将image文件继承与官方的3.8版本的Python
FROM python:3.8
# 将当前目录下的所有文件(除了.dockerignore排除的路径),都拷贝进image文件的/app目录。
COPY . /app
# 指定接下来的工作路径为/app
WORKDIR /app
# 在/app目录下,运行python文件
CMD python3 hello.py

@ -0,0 +1 @@
print("hello world")
Loading…
Cancel
Save