学习使用docker遇到的问题

1.(中文版资料中)docker-compose.yml 格式问题

参考示例运行 docker stack deploy -c docker-compose.yml getstartedlab

报错 yaml: line 1: mapping values are not allowed in this context

对应中文资料:https://docs.docker-cn.com/get-started/part3/#docker-composeyml

原因:中文资料有点坑,yml文件语法有问题,冒号之后没有空格。但是英文的就没问题,是不是copy的时候没有注意。

解决:冒号之后加空格,语法就正确,运行就成功了。

2.docker login的问题

Username: yanshinian
Password:
Error saving credentials: error storing credentials - err: exit status 1, out: `The user name or passphrase you entered is not correct.`

参考链接:https://github.com/docker/docker-credential-helpers/issues/65

解决办法:rm /usr/local/bin/docker-credential-osxkeychain

之后

yanshiniandeMBP:~ yanshinian$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: yanshinian
Password:
Login Succeeded

3.跟着这个教程做练习http://www.docker.org.cn/book/docker/run-saved-image-11.html

bogon:openresty-1.13.6.1 yanshinian$ docker run learn/tutorial ping www.baidu.com
docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled 

解决方法:docker run learn/tutorial /bin/sh -C &&  ping www.baidu.com

参考链接:https://stackoverflow.com/questions/27158840/docker-executable-file-not-found-in-path

你可能感兴趣的:(学习使用docker遇到的问题)