18.4k views
1 vote
What command is used to tag an image called 'httpd:latest' to a new name called 'httpd:old'?

A) docker tag httpd:latest httpd:old

B) docker rename httpd:latest httpd:old

C) docker tag httpd:old httpd:latest

D) docker rename httpd:latest httpd:old

1 Answer

5 votes

Final answer:

The correct command is 'docker tag httpd:latest httpd:old' which uses the 'docker tag' command to create a new tag for an existing image in Docker.

Step-by-step explanation:

The correct command to tag an image called 'httpd:latest' to a new name called 'httpd:old' is A) docker tag httpd:latest httpd:old. The 'docker tag' command is used for creating a tag TARGET_IMAGE that refers to SOURCE_IMAGE. By using this command, you create a reference to the image with the new tag without changing the original image. Docker does not have a 'rename' command for images, which makes options B and D incorrect. The order in the command C is reversed; the correct syntax requires the source name first followed by the new tag name.

User Mononofu
by
8.1k points