Reputation: 8164
My Dockerfile
FROM openjdk:8-jdk-alpine
WORKDIR /opt/app
COPY target/pichk-0.0.1-SNAPSHOT.jar /opt/app/
CMD ["java","-jar","pichk-0.0.1-SNAPSHOT.jar"]
EXPOSE 8090
When I run image
docker run -p 8090:8090 pichk:001
I got error
docker: you are not authorized to perform this operation: server returned 401.
I am adding target permissions line
drwxrwxr-x 9 miki miki 4096 Jan 4 13:59 target/
docker inspect shows
"ContainerConfig": {
"Hostname": "a85050e37362",
"Domainname": "",
"User": "",
What could cause this issue?
Upvotes: 1
Views: 2790
Reputation: 31
Check whether the variable DOCKER_CONTENT_TRUST
is enabled or not:
echo $DOCKER_CONTENT_TRUST
If the above shows 1, it means it is enabled and you should disable it by setting it to 0:
export $DOCKER_CONTENT_TRUST = 0
Your docker run
command should work now.
Upvotes: 3
Reputation: 144
Then proceed with the steps below:
Here is my test Dockerfile:
FROM openjdk:8-jdk-alpine
WORKDIR /opt/app
COPY target/aamdevsecops-1.1.1-SNAPSHOT.jar /opt/app/
CMD ["java","-jar","aamdevsecops-1.1.1-SNAPSHOT.jar"]
Of course, i changed the <name>
, <version>
and <artifactoryId>
in pom.xml file to match my Dockerfile.
First, i built the package locally by issuing this command on the intense-api git project folder:
mvn package
Then, I built the docker image out of it:
docker build -t aamdevsecops:1.1.1 .
then logged in to docker with my hub.docker.com credentials.
docker login # you will be prompted for credentials of hub.docker.com account
tagged the image: docker tag <Image ID> aamdevsecops/devops-bootcamp:latest
then: docker push aamdevsecops/devops-bootcamp:1.1.1
Finally, I did:
docker run --name aamdevsecops -p 8090:8090 aamdevsecops/devops-bootcamp:latest
And here's the result:
dissecting what terms mean:
docker tag <image id> aamdevsecops/devops-bootcamp:latest
docker build -t
command, adds
a tag to it. (a version).docker push aamdevsecops/devops-bootcamp
docker run --name aamdevsecops -p 8090:8090 aamdevsecops/devops-bootcamp:latest
Upvotes: 1