Docker/Docker in WSL: Difference between revisions
< Docker
(One intermediate revision by the same user not shown) | |||
Line 35: | Line 35: | ||
sudo docker ps | sudo docker ps | ||
# 7. Install hello world: | |||
docker run hello-world | |||
</pre> | </pre> | ||
Compose: | |||
sudo curl -L https://github.com/docker/compose/releases/download/2.4.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | |||
sudo chmod +x /usr/local/bin/docker-compose |
Latest revision as of 02:56, 15 May 2024
Docker in WSL
#/bin/bash # 1. Required dependencies sudo apt-get update sudo apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release # 2. GPG key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # 3. Use stable repository for Docker echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # 4. Install Docker sudo apt-get update sudo apt-get -y install docker-ce docker-ce-cli containerd.io # 5. Add user to docker group sudo groupadd docker sudo usermod -aG docker $USER
Ref: [1]
Additional steps: (doesn't seem to start docker automatically)
# 6. Start Docker: sudo service docker start sudo service docker status sudo docker ps # 7. Install hello world: docker run hello-world
Compose:
sudo curl -L https://github.com/docker/compose/releases/download/2.4.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose