일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 스쿠버다이빙
- 젤다의전설
- poe2
- docker
- WebView
- Linux
- 취미
- window10
- 개발툴
- 세부
- Front-end
- guide
- ubuntu
- 여행
- 오픈워터
- window
- 게임
- 엘든링
- 야생의숨결
- psql
- 씨홀스
- 어드벤스
- JavaScript
- JS
- PostgreSQL
- 다이빙
- 공략
- 뱀파이어서바이벌
- hybride
- 페오엑
- Today
- Total
Rianshin
Utilizing Docker CLI without Docker Desktop 본문
Learn how to replace Docker Desktop as your Docker GUI using Lima VM and Visual Studio Code
Goals
The goal of this article is to provide a light weight and easy alternative to using Docker Desktop. This article will cover Lima VM as an alternative in order to host containers using Docker CLI as well as using VS Code as a Docker Desktop GUI interface replacement.
Lima VM
Lima VM is the first option that was explored, Lima is used to create a standalone Linux environment inside of a terminal which can then be used to run Linux compatible software such as Podman (used for Removing Dependency on Docker).
Installing and setting up Lima guest VM
Lima is available via brew. Once installed, limactl is the CLI that is provided to start a ubuntu VM and allows users to shell into the ubuntu VM. Once shelled into the VM, update the package manager apt and then install k3S
$ brew install lima
$ limactl start ubuntu
$ limactl shell ubuntu
lima $ sudo apt update
lima $ curl -sfL https://get.k3s.io | sh -
lima $ GITHUB_URL=https://github.com/kubernetes/dashboard/releases
VERSION_KUBE_DASHBOARD=$(curl -w ‘%{url_effective}’ -I -L -s -S lima ${GITHUB_URL}/latest -o /dev/null | sed -e ‘s|.*/||’)
sudo k3s kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml
lima $ exit
Minimal install of Docker CLI for local development
Lima also provides a lightweight VM for running docker builds from the mac development environment. Download the docker.yaml file to your local workstation (https://github.com/lima-vm/lima/blob/master/examples/docker.yaml) saving the file as docker.yaml and run the following commands.
$ limactl start ./docker.yaml
$ limactl shell docker
lima $ sudo systemctl enable ssh.service
Once the shell is available, the mac host can now be set up to reference the docker engine installed on the lima vm. The example below shows how to build a local docker file using the remote docker.
$ export DOCKER_HOST=ssh://localhost:60006
$ docker build -t limadockertest .
Sending build context to Docker daemon 2.56kB
Step 1/6 : FROM ubuntu:latest
— -> fb52e22af1b0
Step 2/6 : LABEL maintainer=”myname@somecompany.com”
— -> Using cache
— -> c37f3494497d
Step 3/6 : RUN apt-get update && apt-get upgrade -y
— -> Using cache
— -> e808af724770
Step 4/6 : RUN apt-get install nginx -y
— -> Using cache
— -> ed77ce72f229
Step 5/6 : EXPOSE 80
— -> Using cache
— -> 04279fe5c368
Step 6/6 : CMD [“nginx”, “-g”, “daemon off;”]
— -> Using cache
— -> 800d58e28779
Successfully built 800d58e28779
Successfully tagged limadockertest:latest
Use ‘docker scan’ to run Snyk tests against images to find vulnerabilities and learn how to fix them
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
limadockertest2 latest 800d58e28779 About an hour ago 162MB
limadockertest latest 800d58e28779 About an hour ago 162MB
ubuntu latest fb52e22af1b0 13 days ago 72.8MB
```
Once this images have been verified to be in the docker repo, we can verify it is also showing the same results in the linux guest VM.
```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
limadockertest2 latest 800d58e28779 About an hour ago 162MB
limadockertest latest 800d58e28779 About an hour ago 162MB
ubuntu latest fb52e22af1b0 13 days ago 72.8MB
Once these steps are complete, you may want to deploy these containers to a K8 environment running on the Lima-VM. The sections above walks through installing K3S (Installing and setting up Lima guest VM) and discuss importing images into K3S. For a quick recap, the follow steps can be done…
Local mac machine
$ docker save — output limadockertest2.tar limadockertest2
Guest Lima VM
lima $ curl -sfL https://get.k3s.io | sh -
lima $ sudo k3s ctr images import test/limadockertest2.tar
unpacking docker.io/library/limadockertest2:latest (sha256:ec240d997ec5f7800317da08e4ae4506599ffaf25c611fa1338f08df35edfcb1)…done
VS Code Integration
For simple interaction and a similar graphic interface to Docker Desktop it is possible to integrate Lima with VS Code
The first step is to ssh into your lima environment from VS Code using the ssh button in the bottom left corner and selecting “Connect to Host” from the drop down list:
You will then want to enter your ssh location in order to connect to the lima environment:
VS Code will now open a new window and setup the connection, finally add the Docker extension within this new environment:
You will now be able to see all containers and images within your lima environment and interact with files just as if they were on your local machine.
출처 : https://itnext.io/utilizing-docker-cli-without-docker-desktop-4933f3473d5e
'Develop' 카테고리의 다른 글
외부에서 postgresql접속(localhost X) (0) | 2024.05.03 |
---|---|
[Docker]도커 유료화 대응 (1) | 2024.03.13 |
Mac에서 Docker Desktop 사용하지 않고 Docker 사용하기 (feat. minikube) (1) | 2024.03.13 |
Curl 명령어 정리, 예제 (1) | 2024.01.23 |
[nginx] 504 Gateway Time-out (0) | 2024.01.23 |