diff --git a/docs/c.html b/docs/c.html index 8d03217e..61379946 100644 --- a/docs/c.html +++ b/docs/c.html @@ -1531,6 +1531,32 @@ // 输出 // 文件大小: 18 bytes +

杂项

+

Docker 运行环境

+ +
    +
  • 安装 Docker
  • +
  • 创建 Dockerfile 文件 +
    FROM alpine:3.14
    +RUN apk add --no-cache gcc musl-dev
    +RUN apk add --no-cache g++
    +
    +
  • +
  • 生成本地 myalpine 镜像 +
    docker build -t myalpine .
    +
    +
  • +
  • 运行映像,把当前路径 ($PWD) 映射至容器的 /test 目录,用 gcc 编译程序,exit返回 +
    docker run -it -v $PWD:/test myalpine
    +root@b1a38bd7107a:/# cd test
    +root@b1a38bd7107a:/test# gcc -o hello hello.c
    +Hello World
    +root@b1a38bd7107a:/test# exit
    +exit
    +
    +
  • +
+

另见