Docker dind:无法连接到Docker守护程序

时间:2018-03-20 17:25:17

标签: docker gitlab-ci docker-dind

在运行 <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="68dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent"> <GridLayout android:id="@+id/gridLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="2" android:orientation="horizontal" android:rowCount="9"> <TextView android:id="@+id/nameLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/nomeLabel" /> <EditText android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:inputType="textPersonName" /> <TextView android:id="@+id/surnameLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cognomeLabelVal" /> <EditText android:id="@+id/surname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:inputType="textPersonName" /> <Button android:id="@+id/saveId" android:layout_width="wrap_content" android:layout_height="wrap_content" android:enabled="false" android:onClick="save" android:text="@string/saveName" /> </GridLayout> </ScrollView> 时,我无法使用docker:dind命令和任何其他docker命令。

我的用例是我有一个Nexus Docker Registry,我正试图通过GitLab CI连接到这个注册表。

docker login

提供:

docker run --rm -it docker:stable-dind docker login -u user -p password https://registry.mine.io

2 个答案:

答案 0 :(得分:1)

只需将--privileged添加到命令。

docker run --rm -it --privileged docker:stable-dind docker login -u user -p password https://registry.mine.io

答案 1 :(得分:0)

我在本文中找到了相同问题的解决方案 https://www.santoshsrinivas.com/docker-on-ubuntu-16-04/

您需要与gitlab-ci工作者一起在计算机上运行下一条命令

sudo groupadd docker
sudo gpasswd -a gitlab-runner docker
sudo service docker restart