为什么我可以在詹金斯码头容器内运行任何docker命令?
在我的EC2实例中,我从运行的Jenkins容器中创建了一个Docker映像,以将现有作业获取到新图像。然后,我使用不同的端口映射运行了新图像。然后,当我进入新容器中并运行Docker PS
时。但是我遇到了一个错误
root@6151a7f83e0f:/# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@6151a7f83e0f:/#
,然后我尝试使用此Sudo Service Docker Start在新容器内启动Docker。但是我收到以下错误,
etc/init.d/docker: 96: ulimit: error setting limit (Operation not permitted)
我在这里错过了什么?
仅供参考,上面的命令在旧容器中工作正常。仅供参考,这项工作的全部目的是将Jenkins从一个实例迁移到另一个实例,而无需创建新鲜的Jenkins容器。
In my EC2 instance, I created a docker image from a running Jenkins container to get the existing jobs to the new image. Then I ran the new image with a different port mapping. Then when I enter inside the new container and ran docker ps
. But i got an error like below
root@6151a7f83e0f:/# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@6151a7f83e0f:/#
Then I tried to start docker inside the new container with this sudo service docker start. But I received below error,
etc/init.d/docker: 96: ulimit: error setting limit (Operation not permitted)
What am I missing here?
FYI, above commands are working fine in the old container. FYI, the whole purpose of this work is to migrate Jenkins from one instance to another without creating a fresh Jenkins container.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查旧容器是否正在使用
root
以外的其他用户运行。通常,詹金斯将创建一个名为Jenkins的新用户。如果是这样,请从root切换到正确的用户,然后尝试执行命令。更新:我假设您从运行的EC2实例中创建了图像而无需重新启动。如果您这样做可能会有问题。 AWS页面有警告。检查下面。
Check whether the old container is running with a different user other than the
root
. Normally Jenkins will create a new user called Jenkins. If so switch to the correct user from root and try to execute the commands.Update: I assume you created the image from a running EC2 instance without rebooting. There can be issues if you do so. AWS page has a Warning for this. Check the below.