0
0
Jenkinsdevops~10 mins

Docker Pipeline plugin in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to build a Docker image named 'myapp' using the Docker Pipeline plugin.

Jenkins
docker.build('[1]')
Drag options to blanks, or click blank then click option'
Abuild
Bimage
Cmyapp
Dcontainer
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build' or 'container' instead of the image name.
Leaving the argument empty.
2fill in blank
medium

Complete the code to run a Docker container from the image 'myapp' and execute the command 'echo Hello'.

Jenkins
docker.image('myapp').[1]('echo Hello')
Drag options to blanks, or click blank then click option'
Arun
Bbuild
Cinside
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build' which is for building images.
Using 'inside' which is for running commands inside an existing container context.
3fill in blank
hard

Fix the error in the code to push the Docker image 'myapp' to the registry.

Jenkins
docker.image('myapp').[1]()
Drag options to blanks, or click blank then click option'
Apush
Bpublish
Cupload
Ddeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'publish' or 'upload' which are not valid methods.
Using 'deploy' which is unrelated to Docker image pushing.
4fill in blank
hard

Fill both blanks to run a command inside a Docker container with a custom environment variable.

Jenkins
docker.image('myapp').inside("-e [1]=[2]") {
  sh 'printenv'
}
Drag options to blanks, or click blank then click option'
AMY_VAR
BVALUE
CENV_VAR
D123
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping variable name and value.
Using invalid method names or flags.
5fill in blank
hard

Fill all three blanks to build a Docker image, tag it with 'latest', and push it to the registry.

Jenkins
def app = docker.[1]('[2]')
app.[3]()
Drag options to blanks, or click blank then click option'
Abuild
Bmyapp:latest
Cpush
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'push' to upload the image.
Omitting the tag in the image name.