必须承认我不是docker专家,但是尽管开始在命令行上登录docker还是有问题:
awk -F':' 'NF{sub(/^ +/,"",$2);a[$1]=(a[$1]?a[$1] ORS $2:$2)} END{for(i in a){print i ORS a[i]}}' Input_file
这是项目中的yaml文件:
awk -F':' ' ##Setting field separator as colon here.
NF{ ##Checking if NF value is NOT NULL where NF is number of fields in current line.
sub(/^ +/,"",$2) ##Using sub function of awk which substitutes all initial/starting space from $2(second field) with NULL.
a[$1]=(a[$1]?a[$1] ORS $2:$2) ##Creating an array named a whose index is first field of current line and concatenating $2 values to its previous value.
} ##Closing block for NF condition here.
END{ ##Starting END condition of awk command here.
for(i in a){ ##Starting a for loop to traverse through array a here.
print i ORS a[i] ##Printing index of array a which is variable i now and ORS(new line) and then value of array a whose index is variable i.
} ##Closing block for for loop here.
}' Input_file ##Mentioning Input_file name here.
这是docker文件:
AdminsMacBook-2:dockertest newadmin$ sudo docker-compose -f src/main/docker/app.yml up
Password:
WARNING: Found orphan containers (docker_dockertest-sonar_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Pulling dockertest-app (dockertest:latest)...
ERROR: pull access denied for dockertest, repository does not exist or may require 'docker login'
答案 0 :(得分:1)
您需要先构建应用程序的Docker映像,然后才能启动它。 dockertest2
在您的本地Docker映像中不存在。
要创建应用程序的Docker映像并将其推送到Docker注册表中:
使用Maven,输入:
./mvnw package -Pprod verify jib:dockerBuild
使用Gradle,输入:
./gradlew -Pprod bootWar jibDockerBuild
这将使用prod配置文件打包您的应用程序,并使用Jib连接到本地Docker守护程序来构建Docker映像。