@@ -38,22 +38,33 @@ In the following image, you can see an example Docker command from Docker Hub. T
38
38
39
39
## Push the image
40
40
41
- 1 . In the command line, run the ` docker push ` command that you see on Docker
42
- Hub. Note that your command will have your Docker ID, not "docker". For example, ` docker push YOUR-USER-NAME/getting-started ` .
41
+ Let's try to push the image to Docker Hub.
42
+
43
+ 1 . In the command line, run the following commmand:
44
+
45
+ ``` console
46
+ docker push docker/getting-started
47
+ ```
48
+
49
+ You'll see an error like this:
43
50
44
51
``` console
45
52
$ docker push docker/getting-started
46
53
The push refers to repository [docker.io/docker/getting-started]
47
54
An image does not exist locally with the tag: docker/getting-started
48
55
```
49
56
50
- Why did it fail? The push command was looking for an image named ` docker/getting-started ` , but
51
- didn't find one. If you run ` docker image ls ` , you won't see one either.
57
+ This failure is expected because the image isn't tagged correctly yet.
58
+ Docker is looking for an image name ` docker/getting started ` , but your
59
+ local image is still named ` getting-started ` .
52
60
53
- To fix this, you need to tag your existing image you've built to give it another name.
61
+ You can confirm this by running:
54
62
55
- 2 . Sign in to Docker Hub using the command ` docker login -u YOUR-USER-NAME ` .
63
+ ``` console
64
+ docker image ls
65
+ ```
56
66
67
+ 2 . To fix this, first sign in to Docker Hub using your Docker ID: ` docker login YOUR-USER-NAME ` .
57
68
3 . Use the ` docker tag ` command to give the ` getting-started ` image a new name. Replace ` YOUR-USER-NAME ` with your Docker ID.
58
69
59
70
``` console
0 commit comments