=================
== The Archive ==
=================

[Docker ๐Ÿณ] Colima ๋กœ Docker Desktop ๋Œ€์ฒดํ•˜๊ธฐ

|

colima

Notice

๊ฐœ์š”

ํ˜„์žฌ ๋„์ปค๋Š” docker engine ์€ ๋ˆ„๊ตฌ๋‚˜ ๋ฌด๋ฃŒ๋กœ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

ํ•˜์ง€๋งŒ docker desktop ์€ ๊ฐœ์ธ ์‚ฌ์šฉ์ž์—๊ฒŒ๋Š” ๋ฌด๋ฃŒ๋กœ, ๊ธฐ์—…์—๊ฒŒ๋Š” ๋”์ด์ƒ ๋ฌด๋ฃŒ๋กœ ์ œ๊ณต๋˜์ง€ ์•Š๋Š”๋‹ค.

๊ทธ๋ž˜์„œ ์˜คํ”ˆ์†Œ์Šค๋ฅผ ์ฐพ์•„ ๋– ๋‚˜๋Š” ์—ฌ์ •์ด๋‹ค.

๋ฌผ๋ก  ์ถฉ๋ถ„ํžˆ ์ง€๊ธˆ ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ๊ธฐ๋Šฅ๋“ค์„ ๋Œ€์ฒดํ•  ์ˆ˜ ์žˆ์–ด์•ผ ๊ฐ€๋Šฅํ•˜๊ธฐ์— ๊ฐ„ ์ข€ ๋ณด๊ณ  ๊ฒฐ์ •ํ•˜์˜€๋‹ค.

Colima ๋ž€?

Colima๋Š” MacOS/Linux์—์„œ ์ปจํ…Œ์ด๋„ˆ ๋Ÿฐํƒ€์ž„์„ ์ œ๊ณตํ•˜๋Š” Lima ๊ธฐ๋ฐ˜์˜ VM ์ด๋‹ค.

Colima vs Docker Desktop

์„ฑ๋Šฅ์ ์ธ ๋ถ€๋ถ„์—์„œ ์œ ์˜๋ฏธํ•œ ์ฐจ์ด๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•œ๋‹ค.

๊ธฐ์กด Docker Desktop ๊ณผ ๊ด€๋ จ๋œ ๋ชจ๋“  ๋ฐ์ดํ„ฐ ์ง€์šฐ๊ธฐ

์•„๋ž˜ ์ˆœ์„œ๋Œ€๋กœ ์‹คํ–‰ํ•ด์•ผ ํ•œ๋‹ค.

Containers

1
docker rm -f $(docker ps -a -q)

Volumes

1
docker volume rm $(docker volume ls -q)

Images

1
docker rmi $(docker images -a -q)

Volume ์„ ์‚ญ์ œ ์•ˆํ•˜๊ณ  Migration ํ•˜๋ ค๋ฉด?

์ž˜ ๋ชจ๋ฅด๊ฒ ๋‹คโ€ฆ ๐Ÿ˜ข

docker, docker-compose ์„ค์น˜ํ•˜๊ธฐ

1
brew install docker docker-compose

์ดํ›„์—, ์•„๋ž˜๋ฅผ ์‹คํ–‰ํ•ด์„œ ์ถ”๊ฐ€ํ•ด์ฃผ์ž.

1
2
3
# Compose is now a Docker plugin. For Docker to find this plugin, symlink it:
mkdir -p ~/.docker/cli-plugins
ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose

Colima ์„ค์น˜ํ•˜๊ธฐ

์„ค์น˜ํ•˜๊ธฐ

brew ๊ฐ€ ์งฑ์ธ๊ฒƒ์ด๋‹ค.

1
brew install colima

์™ธ์—๋„ ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค.

์„ค์ •ํ•˜๊ธฐ

$HOME/.docker/config ํŒŒ์ผ์— "credsStore": "desktop" ๋ผ์ธ์ด ์žˆ์œผ๋ฉด ์ง€์›Œ์ฃผ๋ฉด ์ข‹๋‹ค.

์‹œ์ž‘ํ•˜๊ธฐ

1
colima start

์ข…๋ฃŒํ•˜๊ธฐ (์‚ญ์ œํ•˜๊ธฐ)

1
2
colima stop # ์ข…๋ฃŒํ•˜๊ธฐ
colima delete # delete existing instance

ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•

๊ฐ„๋‹จํ•˜๋‹ค. docker ps -a ๋กœ ์ •์ƒ ์‹คํ–‰๋๋Š”์ง€ ํ™•์ธํ•˜๋ฉด ๋œ๋‹ค.

1
docker ps -a

Testcontainers ์‚ฌ์šฉ์‹œ ์„ค์ •๋“ค

๊ฐœ๋ฐœ์‹œ Testcontainers๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๋‹ค.

์ด๋Ÿด ๊ฒฝ์šฐ ์•„๋ž˜ ๊ฐ’์„ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$ vim ~/.zshrc

# insert below config
# https://www.testcontainers.org/supported_docker_environment/#using-colima
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export DOCKER_HOST="unix://${HOME}/.colima/docker.sock"

$ colima start

# after colima started, run IntelliJ
# https://www.rockyourcode.com/testcontainers-with-colima/
# Test successed

IntelliJ config

(https://www.jetbrains.com/help/idea/docker.html)

  1. docker ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์„ค์น˜๋˜์–ด์žˆ์–ด์•ผ ํ•œ๋‹ค.
  2. Preferences โ†’ Build, Execution, Deployment โ†’ Docker ๋กœ ๊ฐ€์„œ Colima ๋ฅผ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

References

Colima

Testcontainers

Categories:

Tags: