t_wの輪郭

Feedlyでフォローするボタン
DockerUbuntu
あれ『Ubuntu | Docker Docs』あれ

あれ

2025/7/5 14:27:00
FROM ubuntu:latest

# Install dependencies
RUN apt-get update && \
    apt-get install -y curl tar libunwind8 gettext jq && \
    rm -rf /var/lib/apt/lists/*


# INSTALL DOCKER
# Add Docker's official GPG key:
RUN apt-get update
RUN apt-get install -y ca-certificates curl
RUN install -m 0755 -d /etc/apt/keyrings
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
RUN chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
RUN echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update

# Install docker-ce and containerd
RUN apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin


# INSTALL GITHUB ACTIONS SELF-HOSTED RUNNER
# Create a folder for the runner
WORKDIR /actions-runner

# Download the latest runner package
RUN curl -o actions-runner-linux-x64-2.325.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.325.0/actions-runner-linux-x64-2.325.0.tar.gz

# Optional: Validate the hash
RUN echo "5020da7139d85c776059f351e0de8fdec753affc9c558e892472d43ebeb518f4  actions-runner-linux-x64-2.325.0.tar.gz" | sha256sum

# Extract the installer
RUN tar xzf ./actions-runner-linux-x64-2.325.0.tar.gz

ENV RUNNER_ALLOW_RUNASROOT=1

# Set the working directory to /actions-runner
WORKDIR /actions-runner

# Start the runner
CMD ["./config.sh --url https://github.com/xxxx/yyyy --token $RUNNER_TOKEN && ./run.sh"]

あれ

2025/7/4 23:06:00

出典:『Ubuntu | Docker Docs』


Dockerのaptレポジトリを設定する

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Dockerをインストールする

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

動作確認する

sudo docker run hello-world