To tag a Docker image, you can use the ‘docker tag’ command.
Here is the syntax:
```
docker tag source_image:tag target_image:tag
```
- source\_image:tag – This is the name of the image that you want to tag. If you don’t give a tag, Docker uses “latest” as default.
- target_image:tag – This is the name that you want to give to your image. It’s the user-friendly name for the source_image:tag.
For example, if you want to tag an image with the ID ‘abcdef123456’ as ‘my\_image:1.0’, you would run:
```
docker tag abcdef123456 my_image:1.0
```
This command assigns the tag ‘1.0’ to the image ‘my_image’. Now, you can refer to the image either by its original ID (‘abcdef123456’) or by the tag (‘my_image:1.0’).
You can also use ‘docker image tag’ command to achieve the same result.
Remember, if you want to push this image to Docker Hub you need the name to be in the format – username/repository:tag
```
docker tag abcdef123456 username/my_image:1.0
```
After tagging, you can push this to Docker Hub:
```
docker push username/my_image:1.0
```