为什么我可以在詹金斯码头容器内运行任何docker命令?

发布于 2025-02-07 05:00:50 字数 573 浏览 1 评论 0原文

在我的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是我以为 2025-02-14 05:00:50

检查旧容器是否正在使用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.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文