From 7ba999be072082e0ace1288b9cb933f4a30622ab Mon Sep 17 00:00:00 2001 From: jaywcjlove Date: Thu, 13 Oct 2022 08:41:07 +0000 Subject: [PATCH] doc: update `docs/c.md` 4460aa92468f886695ea6455e2ee7879340a92af --- docs/c.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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
    +
    +
  • +
+

另见