简体   繁体   English

GitHub 操作:获取所有作业命令以在 Docker 容器中运行

[英]GitHub Actions: Get all job commands to run in a Docker container

For GitHub Actions, I'd like to run all commands for a job in a Docker container, but am having trouble getting this to work.对于 GitHub Actions,我想在 Docker 容器中运行作业的所有命令,但无法使其正常工作。 Here's the code for my action:这是我的操作代码:

name: PR Checks

on: [push]

jobs:
  my_checks:
    container: 
      image: docker://alpine:latest
    runs-on: ubuntu-18.04
    steps:
      - run: uname -a
      - run: cat /proc/version

The output of it indicates that the commands are running on the host Ubuntu rather than the Alpine Linux.它的输出表明命令在主机 Ubuntu 上运行,而不是在 Alpine Linux 上运行。 Here's the output that indicates it:这是指示它的输出:

在此处输入图片说明

How do I get these commands to run inside the container: image?如何让这些命令在container:内运行container:图像?

(As an aside, I saw this question , but the answer doesn't work) (顺便说一句,我看到了这个问题,但答案不起作用)

(请参阅对问题的评论。答案就在那里。问题中的代码示例确实在容器中运行命令。感谢 @DavidMaze 和 @smac89!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM