Docker Community Forums

Share and learn in the Docker community.

Pushing Docker Image to AWS Error Message "err: exec: "docker-credential-osxkeychain": executable file not found in $PATH, out: ``"

Hello I am trying to push a docker image via shell command programming do AWS EC2 Container Service. But I am having trouble doing that and I am getting the following error message:

error getting credentials - err: exec: “docker-credential-osxkeychain”: executable file not found in $PATH, out: ``

This error message is returned from my java class. If it do everything manual it works fine.
I am really new to this so not sure how i can do that an the guy from amazon AWS told me it is a docker error so hopefully i get here the right answer.

This is my Dockerfile:

FROM java:7
COPY . /Users/betzenben/Desktop/OGC/Projects/Getting_started/Docker/Directory
WORKDIR /Users/betzenben/Desktop/OGC/Projects/Getting_started/Docker/Directory
RUN javac Time_app.java
CMD ["java", "Time_app"]
Run : ~/Users/betzenben/Desktop/OGC/Projects/Getting_started/Docker/Directory/config.json 

And this my config.json file

{
    "apps": [
         {
         "credsStore": "osxkeychain"
         }
    ]
}

And just in case it is needed my shell script code and my java class that calls the shell script.

#!/bin/sh

echo “test1”
getLoginKey="/usr/local/bin/"
getLoginKey+="$(/usr/local/bin/aws ecr get-login --no-include-email --region us-west-2)"
echo “test2”
echo "${getLoginKey}" 

executeLoginKey="$(eval $getLoginKey)"
echo “test3”
sleep 2
echo "${executeLoginKey}" 


tagImage="$(/usr/local/bin/docker tag time_app:latest .....id......dkr.ecr.us-west-2.amazonaws.com/time_a:latest)"
pushImage="$(/usr/local/bin/docker push .....id.......dkr.ecr.us-west-2.amazonaws.com/time_a:latest)"
wait
echo “test4”
sleep 5
echo "${pushImage}" 
echo "Image Pushed" 

Java Code:

package awstest;

import java.io.*;

public class Main {

  public static void main(String[] args) throws InterruptedException, IOException {
	 
	Process p1 = Runtime.getRuntime().exec("chmod +x /Users/betzenben/Desktop/tag_push_image_AWS.sh");

	BufferedReader stdInput1 = new BufferedReader(new InputStreamReader(p1.getInputStream()));
    BufferedReader stdError1 = new BufferedReader(new InputStreamReader(p1.getErrorStream()));

    System.out.println("STDOUT:\n");
    String s1 = null;
    while ((s1 = stdInput1.readLine()) != null) {
      System.out.println(s1);
    }
    System.out.println("STDERR:\n");
    while ((s1 = stdError1.readLine()) != null) {
      System.out.println(s1);
    }

    Process p = Runtime.getRuntime().exec("/Users/betzenben/Desktop/tag_push_image_AWS.sh");

    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));

    System.out.println("STDOUT:\n");
    String s = null;
    while ((s = stdInput.readLine()) != null) {
      System.out.println(s);
    }
    System.out.println("STDERR:\n");
    while ((s = stdError.readLine()) != null) {
      System.out.println(s);
    }
  }
}

I recommend posting questions about AWS ECS forums: https://forums.aws.amazon.com/forum.jspa?forumID=187

@friism Thank you I will post it there