Hi.
You are not showing the commands you use to commit the docker image, tag the docker image, push the docker image or pull the docker image, so it is hard to assist you.
A docker commit
just builds an image on the local machine. It does not push it to a registry and it does not make it available to other docker nodes.
Here’s an example from my Docker Swarm environment with 1 manager and 2 workers. I will push an image up to my private registry in AWS ECR on the manager node and then run a container from that image on a worker node. My private registry in AWS ECR is 641851146588.dkr.ecr.us-east-1.amazonaws.com
.
🐳 root@172.16.129.75:[~] $ hostname
manager.example.com
🐳 root@172.16.129.75:[~] $ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
a49ha9p64gait59go1sc1iexl * manager.example.com Ready Active Leader 18.09.1
foxhv12a6u9z1e0y0gxvrnw6g worker1.example.com Ready Active 18.09.1
brn0ata5azwe3y09xvobj1qho worker2.example.com Ready Active 18.09.1
🐳 root@172.16.129.75:[~] $
On my manager node I log in to my AWS ECR private registry with a docker login command to my AWS ECR private registry.
🐳 root@172.16.129.75:[~] $ docker login -u AWS -p **my-aws-ecr-password** https://641851146588.dkr.ecr.us-east-1.amazonaws.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
On my manager
node I tag an image in order to push it up to my private registry in AWS ECR. I then push it up to my AWS ECR private registry. My AWS ECR private registry is 641851146588.dkr.ecr.us-east-1.amazonaws.com
. I will tag the image and push it up to a repository named gforghetti/apache
. I created the gforghetti/apache
repository in my AWS ECR private registry prior to this from the AWS ECR console. I will give the image a tag of latest
. So the full image name will be 504948365413 641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache:latest
.
🐳 root@172.16.129.75:[~] $ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
gforghetti/apache latest 504948365413 12 hours ago 133MB
🐳 root@172.16.129.75:[~] $ docker image tag 504948365413 641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache:latest
🐳 root@172.16.129.75:[~] $ docker image push 641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache:latest
The push refers to repository [641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache]
b29cbb1c94ef: Pushed
34c671894ba8: Pushed
6b718024b06b: Pushed
eae00250502c: Pushed
9464fb202df9: Pushed
e1049375b47d: Pushed
f8a0a368bee8: Pushed
3c816b4ead84: Pushed
latest: digest: sha256:7237a2b69ecfa8b458b43b34c0f56d7940241e4e38ab604cc8647cd16f4437c2 size: 1993
Now on the worker1
node I can run a container from that image stored in my private registry in AWS ECR.
🐳 root@172.16.129.76:[~] $ hostname
worker1.example.com
On the worker1
node I need to login to my private registry in AWS ECR in order to pull images from it and run containers from them.
🐳 root@172.16.129.76:[~] $ docker login -u AWS -p **my-aws-ecr-password** https://641851146588.dkr.ecr.us-east-1.amazonaws.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
I can then run a container from the image stored in my private registry in AWS ECR.
🐳 root@172.16.129.76:[~] $ docker container run -it --name apache -p 80:80 641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache:latest
Unable to find image '641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache:latest' locally
latest: Pulling from gforghetti/apache
5e6ec7f28fb7: Pull complete
566e675a8212: Pull complete
ef5a8026039b: Pull complete
22ecb0106557: Pull complete
91cc511c603e: Pull complete
702a920b29ec: Pull complete
4479f1020334: Pull complete
0c74fd3c1e98: Pull complete
Digest: sha256:7237a2b69ecfa8b458b43b34c0f56d7940241e4e38ab604cc8647cd16f4437c2
Status: Downloaded newer image for 641851146588.dkr.ecr.us-east-1.amazonaws.com/gforghetti/apache:latest
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Feb 02 15:08:27.442598 2019] [mpm_event:notice] [pid 1:tid 140121858180288] AH00489: Apache/2.4.38 (Unix) configured -- resuming normal operations
[Sat Feb 02 15:08:27.442728 2019] [core:notice] [pid 1:tid 140121858180288] AH00094: Command line: 'httpd -D FOREGROUND'
🐳 root@172.16.129.76:[~] $