LoginSignup
0
0

Jenkins in Docker

Last updated at Posted at 2024-02-05

DockerでJenkinsを構築する

dockerイメージの取得

docker pull jenkins/jenkins:lts

コンテナ起動

docker run -p 8080:8080 -p 50000:50000 --restart=on-failure jenkins/jenkins:lts-jdk17

Jenkinsの初期設定

localhost:8080にアクセス

To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:

/var/jenkins_home/secrets/initialAdminPassword

Please copy the password from either location and paste it below.

ログに出力されたパスワードを入力

image.png

Install suggested plugins
プラグインの設定

image.png

ユーザー作成 adminユーザーで作業を継続する場合はSkip and continue as admin
image.png

URLの設定
image.png

設定完了
adminユーザーでのログインは、先ほどのパスワードを使用してと書いてある
image.png

Jenkinsのダッシュボードが表示される
image.png

Job作成

  1. 新規ジョブ作成
  2. プロジェクトに名前を付ける
  3. フリースタイル・プロジェクトのビルドを選択
  4. ビルド手順の追加(試しにシェルの実行 ls -lah)
  5. ビルドの保存と実行

ビルドの履歴からコンソール出力を選択して実行結果を確認

Started by user admin
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/test_job
[test_job] $ /bin/sh -xe /tmp/jenkins10752324995961363420.sh
+ ls -lah
total 8.0K
drwxr-xr-x 2 jenkins jenkins 4.0K Feb  5 21:50 .
drwxr-xr-x 3 jenkins jenkins 4.0K Feb  5 21:50 ..
Finished: SUCCESS

Reference

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0