Complete the code to build a Docker image named 'myapp' using the Docker Pipeline plugin.
docker.build('[1]')
The docker.build() function requires the image name as a string argument. Here, 'myapp' is the correct image name.
Complete the code to run a Docker container from the image 'myapp' and execute the command 'echo Hello'.
docker.image('myapp').[1]('echo Hello')
The run() method runs a container from the specified image and executes the given command inside it.
Fix the error in the code to push the Docker image 'myapp' to the registry.
docker.image('myapp').[1]()
The push() method uploads the Docker image to the configured Docker registry.
Fill both blanks to run a command inside a Docker container with a custom environment variable.
docker.image('myapp').inside("-e [1]=[2]") { sh 'printenv' }
The inside() method runs commands inside a container. The -e flag sets environment variables. Here, 'MY_VAR' is the variable name and 'VALUE' is its value.
Fill all three blanks to build a Docker image, tag it with 'latest', and push it to the registry.
def app = docker.[1]('[2]') app.[3]()
First, docker.build() builds the image with the tag 'myapp:latest'. Then, push() uploads it to the registry.