jeffmaher
jeffmaher

Reputation: 1902

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. 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. Here's the output that indicates it:

enter image description here

How do I get these commands to run inside the container: image?

(As an aside, I saw this question, but the answer doesn't work)

Upvotes: 4

Views: 680

Answers (1)

jeffmaher
jeffmaher

Reputation: 1902

(See comments on question. Answer is in there. The code sample in the question does run commands in the container. Thanks to @DavidMaze and @smac89!)

Upvotes: 1

Related Questions