コンテンツにスキップ

03. 自作のイメージを起動する

03. 自作のイメージを起動する

nextjs-example-compose.yml
1
2
3
4
5
6
services:
  nextjs-example:
    image: 192.168.11.42:8085/nextjs-example:latest
    ports:
      - "3000:3000"
    restart: always
 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
# docker-compose.ymlを変換する
$ kompose convert --file nextjs-example-compose.yml -o ./nextjs-example-manifests/ --with-kompose-annotation=false

# Minikubeを起動する
$ minikube start --insecure-registry="192.168.11.42:8085"

# マニフェストを適用する
$ kubectl apply -f ./nextjs-example-manifests/

# Podを確認する
$ kubectl get pods
NAME                              READY   STATUS              RESTARTS   AGE
nextjs-example-6fbf69d677-zwql8   0/1     ContainerCreating   0          3s

# Serviceを確認する
$ kubectl get services
NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
kubernetes       ClusterIP   10.96.0.1        <none>        443/TCP    14s
nextjs-example   ClusterIP   10.106.105.156   <none>        3000/TCP   7s

# ポートフォワーディングする
$ kubectl port-forward service/nextjs-example 3000:3000

# 完全消去する
$ minikube delete