"WSL Debian 도커 설치"의 두 판 사이의 차이

68번째 줄: 68번째 줄:
echo 'sudo service docker status || sudo service docker start' >> ~/.bashrc
echo 'sudo service docker status || sudo service docker start' >> ~/.bashrc
</syntaxhighlight>
</syntaxhighlight>
{{소스헤더|docker 서비스 켜져 있지 않은 경우(최초 쉘 진입시 포함)}}
{{소스헤더|docker 서비스 켜져 있지 않은 경우 (최초 쉘 진입시 포함)}}
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
[FAIL] Docker is not running ... failed!
[FAIL] Docker is not running ... failed!

2021년 9월 11일 (토) 18:32 판

1 개요

testuser@DESKTOP-05A79C1:~$ sudo sh get-docker.sh
# Executing docker install script, commit: 93d2499759296ac1f9c510605fef85052a2c32be

WSL DETECTED: We recommend using Docker Desktop for Windows.
Please get Docker Desktop from https://www.docker.com/products/docker-desktop


You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl gnupg >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/debian/gpg" | gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
+ sh -c echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends  docker-ce-cli docker-scan-plugin docker-ce >/dev/null
+ version_gte 20.10
+ [ -z  ]
+ return 0
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce-rootless-extras >/dev/null

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================
testuser@DESKTOP-05A79C1:~$ docker -v
Docker version 20.10.8, build 3967b7d
testuser@DESKTOP-05A79C1:~$ docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
testuser@DESKTOP-05A79C1:~$ sudo service docker start
[ ok ] Starting Docker: docker.
testuser@DESKTOP-05A79C1:~$ sudo service docker status
[ ok ] Docker is running.
testuser@DESKTOP-05A79C1:~$ docker images
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
testuser@DESKTOP-05A79C1:~$ docker run hello-world
...
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
For more examples and ideas, visit:
 https://docs.docker.com/get-started/

2 자동시작

쉘 접속시 docker가 켜져 있지 않으면 켜도록 .bashrc 에 추가하자.

echo 'sudo service docker status || sudo service docker start' >> ~/.bashrc
docker 서비스 켜져 있지 않은 경우 (최초 쉘 진입시 포함)
[FAIL] Docker is not running ... failed!
[ ok ] Starting Docker: docker.
testuser@DESKTOP-05A79C1:~$
docker 서비스 켜져 있는 경우
[ ok ] Starting Docker: docker.
testuser@DESKTOP-05A79C1:~$

3 트러블슈팅

https://github.com/microsoft/WSL/discussions/4872#discussioncomment-99164

testuser@DESKTOP-05A79C1:~$ sudo service docker start
[ ok ] Starting Docker: docker.
testuser@DESKTOP-05A79C1:~$ sudo service docker status
[FAIL] Docker is not running ... failed!
testuser@DESKTOP-05A79C1:~$ sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives: using /usr/sbin/iptables-legacy to provide /usr/sbin/iptables (iptables) in manual mode
testuser@DESKTOP-05A79C1:~$ sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
update-alternatives: using /usr/sbin/ip6tables-legacy to provide /usr/sbin/ip6tables (ip6tables) in manual mode
testuser@DESKTOP-05A79C1:~$ sudo service docker start
[ ok ] Starting Docker: docker.
testuser@DESKTOP-05A79C1:~$ sudo service docker status
[ ok ] Docker is running.

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}