-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a8f675
commit cafd1c6
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
param ( | ||
[string]$ImageName = "jenkins-test:latest", | ||
[string]$ContainerName = "jenkins", | ||
[int]$ExternalWebPort = 8080, | ||
[int]$InternalWebPort = 8080, | ||
[int]$ExternalAgentPort = 50000, | ||
[int]$InternalAgentPort = 50000, | ||
[string]$VolumeMapping = "jenkins_home:/var/jenkins_home" | ||
) | ||
|
||
# Pull the latest Jenkins Docker image | ||
docker pull $ImageName | ||
|
||
# Run the Jenkins container with specified parameters | ||
$ContainerId = $(docker run -d ` | ||
-p "${ExternalWebPort}:${InternalWebPort}" ` | ||
-p "${ExternalAgentPort}:${InternalAgentPort}" ` | ||
--name $ContainerName ` | ||
--volume $VolumeMapping ` | ||
--privileged ` | ||
$ImageName) | ||
|
||
Write-Host "Success: The container ID is: ${ContainerId}" -ForegroundColor Green | ||
|
||
# Wait for 7 seconds | ||
Start-Sleep -Seconds 7 | ||
|
||
# Retrieve the initial Admin Password | ||
$JenkinsTempPassword = $(docker exec $ContainerName cat /var/jenkins_home/secrets/initialAdminPassword) | ||
Write-Host "Success: Jenkins temp password is ${JenkinsTempPassword}" -ForegroundColor Green |