docker-machine ssh在AWS上

从我的MAC(运行Docker机器),我通过docker-machine命令在AWS上configuration了一个主机。 然后,我将terminal连接到基于EC2的主机,并运行一些docker命令启动一些容器。 当我在我的MAC上执行docker ps命令时,我看到假设应该在EC2主机上运行的容器。

为了validation,我想通过docker-machine sshlogin到主机。 这成功了,但是当在该EC2主机上运行'docker ps'帐户(查看容器)时,我得到了Cannot connect to the Docker daemon. Is the docker daemon running on this host Cannot connect to the Docker daemon. Is the docker daemon running on this host

我怎样才能看到EC2主机上的容器列表? 我如何知道EC2主机上有多less个容器正在运行?

SSH用户不会自动添加到docker组。 请参阅https://github.com/docker/machine/issues/3178 。 因此,您需要自己手动添加(使用usermod -a -G docker docker-user )或使用sudo docker ps