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):

  • Issue withDocker Selenium Grid on VM
  • Running Mkbootstrap for DBI () => DBIXS.h:22:20: fatal error: EXTERN.h: No such file or directory
  • PHP `getEnv` is able to read System Environment Variable
  • how to make fail2ban read json docker logs
  • Mounting AWS EBS volume when launching VM with Docker Machine
  • How can I tell if I'm logged in to a private Docker registry from a script?
  • 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?

  • Service Fabric Cluster with Docker Containers with windowsservercore and iis server
  • X509CertificateValidationMode not working in Linux?
  • Failed to limit memory with docker compose
  • Creating a host directory as a data volume in Dockerfile
  • Web Server and Database Server in a Docker Container
  • angular2 app in nginx:stable-alpine docker image tries to GET a sockjs URL when I bind host 8080 -> container 80, but not 80->80
  • 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.