Cant push docker image to local registry by .sh script called from plink – no basic auth credentials

I have a problem by pushing docker image in the local registry.
I have a local registry for example some.registry.com.
My script looks like (build.sh):

#!/bin/bash
# some commands
# build image
# tag image
docker push some.registry.com/my/imagename

This script works fine if I run it from the current system (i run on ubuntu 16.04):

  • Can't connect to db docker container
  • Permission Issue with Docker Volume Driver for Azure File Storage
  • Logging from Docker
  • A Docker workflow for a developers team
  • create dockerfile to build new images
  • SSH to docker bridged instance
  • sudo ./build.sh
    

    But I need to invoke this script from another script on a windows machine.
    I use for this plink
    This script looks like (other_script.bat):

    REM do something
    call D:\install\plink.exe -ssh -v -t user@xxx.xxx.xxx.xxx -pw PASS "sudo -S <<< 'PASS' /home/user/scr/build.sh"
    

    All command in build.sh are working fine (build image, tag image e.t.c). But when docker push is called I receive a message no basic auth credentials

    Has someone any suggestion?

  • How to restore docker images which are removed by `docker rmi` command?
  • How can I know which docker will restart after docker daemon restarts
  • Possible to run Google Standard Managed VM Locally with Docker for Development?
  • docker mounts host's / directory to container's / in debian wheezy 7.8
  • symfony classes.map failed to open stream: No such file or directory
  • Using Docker for Image training in Python (New to this)
  • One Solution collect form web for “Cant push docker image to local registry by .sh script called from plink – no basic auth credentials”

    Have you tried to put you credentials in a file locally on your machine? Create json.config file under C:\Users\.docker or on Linux at $HOME/.docker/config.json and copy the following content to that file

    {
            "auths": {
                    "your.registry.com": {
                            "auth": "aGVja2VhOiFoZWNrb25vXXXX"
                    }
            } 
    }
    

    Note that the auth string ist your username password in BASE64 encoded. If you have a random Linux docker host where you have logged in to the registry before you can take the whole json.config file from the home directory there as well.

    Sidenote: We had a similar issue with the io.fabric docker-plugin and solved it with the steps described above.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.