본문 바로가기
강의 실습/비전공자도 이해할 수 있는 Docker 입문 실전

컨테이너로 실행시킨 Spring Boot가 MySQL에 연결이 안 되는 이유

by jint 2026. 6. 3.

1. 컨테이너로 실행시킨 Spring Boot 가 MySQL 에 연결이 안 되는 이유

컨테이너로 실행시킨 Spring Boot 가 MySQL 에 연결이 안 되는 이유


각각의 컨테이너는 자신만의 네트워크망과 IP 주소를 가진다. 호스트 컴퓨터 입장에서 localhost 는 호스트 컴퓨터를 가리키지만, Spring Boot 컨테이너 입장에서 localhost 는 Spring Boot 컨테이너를 가리킨다.

이 때 Spring Boot 컨테이너의 application.yml 에 설정된 localhost:3306 은 컨테이너 내부의 3306번 포트와 연결을 시도하게 된다. 하지만 3306번 포트엔 아무것도 실행되지 않았기 때문에, Spring Boot 가 MySQL 에 연결되지 않았던 것이다.

- src/main/resources/application.yaml

...
    url: jdbc:mysql://localhost:3306/mydb
...



2. Spring Boot DB 정보 수정
한 컨테이너에서 다른 컨테이너와 통신하려면, compose.yml 파일에 정의한 service 이름으로 통신할 수 있다.
service 이름이 해당 컨테이너의 IP 주소와 같은 역할을 한다. 즉, 컨테이너 주소를 뜻한다.

- compose.yml

...
  my-server:
...
  my-db:
...


- src/main/resources/application.yaml

...
    # url: jdbc:mysql://localhost:3306/mydb
    url: jdbc:mysql://my-db:3306/mydb
...


코드 수정 후 Spring Boot 프로젝트 빌드한 뒤, 다시 컨테이너를 실행해본다.

- Windows PowerShell

PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> ./gradlew clean build
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

BUILD SUCCESSFUL in 8s
6 actionable tasks: 6 executed
Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.5.1/userguide/configuration_cache_enabling.html
PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker compose up --build -d
#1 [internal] load local bake definitions
#1 reading from stdin 619B 0.0s done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 189B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/eclipse-temurin:17-jdk
#3 ...

#4 [auth] library/eclipse-temurin:pull token for registry-1.docker.io
#4 DONE 0.0s

#3 [internal] load metadata for docker.io/library/eclipse-temurin:17-jdk
#3 DONE 1.3s

#5 [internal] load .dockerignore
#5 transferring context: 2B done
#5 DONE 0.0s

#6 [1/2] FROM docker.io/library/eclipse-temurin:17-jdk@sha256:b04a8c5d46e210873ffd1af6ad5f4d62c69ed3a6736993556eae60bba1373a23
#6 resolve docker.io/library/eclipse-temurin:17-jdk@sha256:b04a8c5d46e210873ffd1af6ad5f4d62c69ed3a6736993556eae60bba1373a23 0.0s done
#6 DONE 0.0s

#7 [internal] load build context
#7 transferring context: 55.82MB 4.2s done
#7 DONE 4.2s

#6 [1/2] FROM docker.io/library/eclipse-temurin:17-jdk@sha256:b04a8c5d46e210873ffd1af6ad5f4d62c69ed3a6736993556eae60bba1373a23
#6 CACHED

#8 [2/2] COPY build/libs/*SNAPSHOT.jar /app.jar
#8 DONE 0.1s

#9 exporting to image
#9 exporting layers
#9 exporting layers 1.2s done
#9 exporting manifest sha256:fba6bd6253bc26f5ddd393aedf6aef5b2177db63d09b3f260aca7cde25179333 0.0s done
#9 exporting config sha256:2cddd1bd5d3ab79ae32acdb1d2a277bec789864bfb7372edf5f7fc924ab83270 0.0s done
#9 exporting attestation manifest sha256:aa5f0e32d4705295473237b8b1b779ba25426d048368da0a53bd8faa9be7d3b7 0.1s done
#9 exporting manifest list sha256:506dde9e43b4935a2c552164c728d9c720ea92776b0d830150c76066e41d2f54
#9 exporting manifest list sha256:506dde9e43b4935a2c552164c728d9c720ea92776b0d830150c76066e41d2f54 0.0s done
#9 naming to docker.io/library/compose-spring-boot-server-my-server:latest done
#9 unpacking to docker.io/library/compose-spring-boot-server-my-server:latest
#9 unpacking to docker.io/library/compose-spring-boot-server-my-server:latest 0.3s done
#9 DONE 1.7s

#10 resolving provenance for metadata file
#10 DONE 0.0s
[+] up 3/3
 ✔ Image compose-spring-boot-server-my-server       Built                                                                                                                                                                       7.9s
 ✔ Container compose-spring-boot-server-my-server-1 Started                                                                                                                                                                     6.3s
 ✔ Container compose-spring-boot-server-my-db-1     Healthy                                                                                                                                                                     5.9s

What's next:
    Filter, search, and stream logs from all your Compose services
    in one place with Docker Desktop's Logs view. docker-desktop://dashboard/logs?appId=compose-spring-boot-server
PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker compose ps
NAME                                     IMAGE                                  COMMAND                   SERVICE     CREATED          STATUS                    PORTS
compose-spring-boot-server-my-db-1       mysql                                  "docker-entrypoint.s…"   my-db       19 hours ago     Up 47 seconds (healthy)   0.0.0.0:3306->3306/tcp, [::]:3306->3306/tcp
compose-spring-boot-server-my-server-1   compose-spring-boot-server-my-server   "java -jar /app.jar"      my-server   48 seconds ago   Up 42 seconds             0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker ps
CONTAINER ID   IMAGE                                  COMMAND                   CREATED          STATUS                    PORTS                                         NAMES
462fa9eae152   compose-spring-boot-server-my-server   "java -jar /app.jar"      53 seconds ago   Up 47 seconds             0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp   compose-spring-boot-server-my-server-1
9f3eaac5fca7   mysql                                  "docker-entrypoint.s…"   19 hours ago     Up 52 seconds (healthy)   0.0.0.0:3306->3306/tcp, [::]:3306->3306/tcp   compose-spring-boot-server-my-db-1


1) 컨테이너 로그 확인
- Windows PowerShell

PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker compose logs
my-server-1  | 
my-db-1      | 2026-06-02 07:45:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.7.0-1.el9 started.
my-server-1  |   .   ____          _            __ _ _
my-db-1      | 2026-06-02 07:45:46+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
my-db-1      | 2026-06-02 07:45:46+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.7.0-1.el9 started.
my-server-1  |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
my-server-1  | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
my-server-1  |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
my-server-1  |   '  |____| .__|_| |_|_| |_\__, | / / / /
my-server-1  |  =========|_|==============|___/=/_/_/_/
my-server-1  | 
my-server-1  |  :: Spring Boot ::                (v4.0.6)
my-server-1  | 
my-server-1  | 2026-06-03T02:25:34.321Z  INFO 1 --- [           main] c.e.c.ComposeSpringBootServerApplication : Starting ComposeSpringBootServerApplication v0.0.1-SNAPSHOT using Java 17.0.19 with PID 1 (/app.jar started by root in /)
my-server-1  | 2026-06-03T02:25:34.325Z  INFO 1 --- [           main] c.e.c.ComposeSpringBootServerApplication : No active profile set, falling back to 1 default profile: "default"
my-server-1  | 2026-06-03T02:25:34.773Z  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
my-db-1      | 2026-06-02 07:45:46+00:00 [Note] [Entrypoint]: Initializing database files
my-db-1      | 2026-06-02T07:45:46.297580Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
my-db-1      | 2026-06-02T07:45:46.298469Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 9.7.0) initializing of server in progress as process 82
my-db-1      | 2026-06-02T07:45:46.305421Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
my-db-1      | 2026-06-02T07:45:46.315016Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
my-db-1      | 2026-06-02T07:45:47.337278Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
my-db-1      | 2026-06-02T07:45:49.714955Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
my-server-1  | 2026-06-03T02:25:34.786Z  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8 ms. Found 0 JPA repository interfaces.
my-db-1      | 2026-06-02T07:45:52.788123Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.
my-db-1      | 2026-06-02 07:45:52+00:00 [Note] [Entrypoint]: Database files initialized
my-db-1      | 2026-06-02 07:45:52+00:00 [Note] [Entrypoint]: Starting temporary server
my-db-1      | 2026-06-02T07:45:52.842544Z 0 [System] [MY-015015] [Server] MySQL Server - start.
my-db-1      | 2026-06-02T07:45:53.131662Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.7.0) starting as process 134
my-db-1      | 2026-06-02T07:45:53.131677Z 0 [System] [MY-015603] [Server] MySQL Server has access to 20 logical CPUs.
my-db-1      | 2026-06-02T07:45:53.131688Z 0 [System] [MY-015603] [Server] MySQL Server has access to 33578594304 bytes of physical memory.
my-db-1      | 2026-06-02T07:45:53.138514Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
my-db-1      | 2026-06-02T07:45:53.160892Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
my-db-1      | 2026-06-02T07:45:53.991241Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
my-db-1      | 2026-06-02T07:45:54.688506Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
my-db-1      | 2026-06-02T07:45:54.688865Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
my-db-1      | 2026-06-02T07:45:54.703706Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
my-db-1      | 2026-06-02T07:45:54.775902Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
my-db-1      | 2026-06-02T07:45:54.775966Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.7.0'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
my-db-1      | 2026-06-02 07:45:54+00:00 [Note] [Entrypoint]: Temporary server started.
my-db-1      | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
my-db-1      | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
my-db-1      | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
my-db-1      | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
my-db-1      | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
my-db-1      | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
my-db-1      | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
my-db-1      | 2026-06-02 07:45:56+00:00 [Note] [Entrypoint]: Creating database mydb
my-db-1      | 
my-db-1      | 2026-06-02 07:45:56+00:00 [Note] [Entrypoint]: Stopping temporary server
my-server-1  | 2026-06-03T02:25:35.090Z  INFO 1 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat initialized with port 8080 (http)
my-server-1  | 2026-06-03T02:25:35.102Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
my-server-1  | 2026-06-03T02:25:35.103Z  INFO 1 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/11.0.21]
my-server-1  | 2026-06-03T02:25:35.131Z  INFO 1 --- [           main] b.w.c.s.WebApplicationContextInitializer : Root WebApplicationContext: initialization completed in 762 ms
my-db-1      | 2026-06-02T07:45:56.308283Z 13 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 9.7.0).
my-db-1      | 2026-06-02T07:45:57.931462Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.7.0)  MySQL Community Server - GPL.
my-db-1      | 2026-06-02T07:45:57.931520Z 0 [System] [MY-015016] [Server] MySQL Server - end.
my-db-1      | 2026-06-02 07:45:58+00:00 [Note] [Entrypoint]: Temporary server stopped
my-db-1      | 
my-db-1      | 2026-06-02 07:45:58+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
my-db-1      | 
my-db-1      | 2026-06-02T07:45:58.328865Z 0 [System] [MY-015015] [Server] MySQL Server - start.
my-server-1  | 2026-06-03T02:25:35.276Z  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
my-server-1  | 2026-06-03T02:25:35.536Z  INFO 1 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@15c6027d
my-db-1      | 2026-06-02T07:45:58.534314Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.7.0) starting as process 1
my-db-1      | 2026-06-02T07:45:58.534356Z 0 [System] [MY-015603] [Server] MySQL Server has access to 20 logical CPUs.
my-db-1      | 2026-06-02T07:45:58.534376Z 0 [System] [MY-015603] [Server] MySQL Server has access to 33578594304 bytes of physical memory.
my-db-1      | 2026-06-02T07:45:58.541070Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
my-db-1      | 2026-06-02T07:45:58.554496Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
my-db-1      | 2026-06-02T07:45:59.364731Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
my-db-1      | 2026-06-02T07:45:59.762209Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
my-db-1      | 2026-06-02T07:45:59.762610Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
my-db-1      | 2026-06-02T07:45:59.780964Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
my-db-1      | 2026-06-02T07:45:59.836019Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
my-db-1      | 2026-06-02T07:45:59.836134Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.7.0'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
my-db-1      | 2026-06-02T08:10:53.327782Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 9.7.0).
my-db-1      | 2026-06-02T08:10:54.002241Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 9.7.0)  MySQL Community Server - GPL.
my-db-1      | 2026-06-02T08:10:54.002265Z 0 [System] [MY-015016] [Server] MySQL Server - end.
my-db-1      | 2026-06-03 02:25:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.7.0-1.el9 started.
my-db-1      | 2026-06-03 02:25:28+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
my-db-1      | 2026-06-03 02:25:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.7.0-1.el9 started.
my-db-1      | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
my-server-1  | 2026-06-03T02:25:35.537Z  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
my-server-1  | 2026-06-03T02:25:35.561Z  INFO 1 --- [           main] org.hibernate.orm.jpa                    : HHH008540: Processing PersistenceUnitInfo [name: default]
my-server-1  | 2026-06-03T02:25:35.599Z  INFO 1 --- [           main] org.hibernate.orm.core                   : HHH000001: Hibernate ORM core version 7.2.12.Final
my-db-1      | 2026-06-03T02:25:28.392471Z 0 [System] [MY-015015] [Server] MySQL Server - start.
my-db-1      | 2026-06-03T02:25:28.642101Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.7.0) starting as process 1
my-db-1      | 2026-06-03T02:25:28.642114Z 0 [System] [MY-015603] [Server] MySQL Server has access to 20 logical CPUs.
my-db-1      | 2026-06-03T02:25:28.642123Z 0 [System] [MY-015603] [Server] MySQL Server has access to 33578594304 bytes of physical memory.
my-db-1      | 2026-06-03T02:25:28.660630Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
my-db-1      | 2026-06-03T02:25:28.677447Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
my-db-1      | 2026-06-03T02:25:29.627657Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
my-db-1      | 2026-06-03T02:25:30.004184Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
my-db-1      | 2026-06-03T02:25:30.004499Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
my-db-1      | 2026-06-03T02:25:30.014489Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
my-db-1      | 2026-06-03T02:25:30.095208Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.7.0'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
my-db-1      | 2026-06-03T02:25:30.095236Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
my-server-1  | 2026-06-03T02:25:35.935Z  INFO 1 --- [           main] o.s.o.j.p.SpringPersistenceUnitInfo      : No LoadTimeWeaver setup: ignoring JPA class transformer
my-server-1  | 2026-06-03T02:25:36.019Z  INFO 1 --- [           main] org.hibernate.orm.connections.pooling    : HHH10001005: Database info:
my-server-1  |  Database JDBC URL [jdbc:mysql://my-db:3306/mydb]
my-server-1  |  Database driver: MySQL Connector/J
my-server-1  |  Database dialect: MySQLDialect
my-server-1  |  Database version: 9.7
my-server-1  |  Default catalog/schema: mydb/undefined
my-server-1  |  Autocommit mode: undefined/unknown
my-server-1  |  Isolation level: REPEATABLE_READ [default REPEATABLE_READ]
my-server-1  |  JDBC fetch size: none
my-server-1  |  Pool: DataSourceConnectionProvider
my-server-1  |  Minimum pool size: undefined/unknown
my-server-1  |  Maximum pool size: undefined/unknown
my-server-1  | 2026-06-03T02:25:36.247Z  INFO 1 --- [           main] org.hibernate.orm.core                   : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
my-server-1  | 2026-06-03T02:25:36.253Z  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
my-server-1  | 2026-06-03T02:25:36.288Z  WARN 1 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
my-server-1  | 2026-06-03T02:25:36.563Z  INFO 1 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat started on port 8080 (http) with context path '/'
my-server-1  | 2026-06-03T02:25:36.578Z  INFO 1 --- [           main] c.e.c.ComposeSpringBootServerApplication : Started ComposeSpringBootServerApplication in 2.65 seconds (process running for 3.128)
my-server-1  | 2026-06-03T02:27:54.546Z  INFO 1 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
my-server-1  | 2026-06-03T02:27:54.546Z  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
my-server-1  | 2026-06-03T02:27:54.547Z  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms

What's next:
    Filter, search, and stream logs from all your Compose services
    in one place with Docker Desktop's Logs view. docker-desktop://dashboard/logs?appId=compose-spring-boot-server


2) 브라우저에서 확인
브라우저에서 http://localhost:8080/ 접속

 

Docker Compose 로 Spring Boot, MySQL 컨테이너 동시에 띄워보기


3) compose 로 실행된 컨테이너 중지 후 삭제
- Windows PowerShell

PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker compose down
[+] down 3/3
 ✔ Container compose-spring-boot-server-my-server-1 Removed                                                                                                                                                                     0.3s
 ✔ Container compose-spring-boot-server-my-db-1     Removed                                                                                                                                                                     1.0s
 ✔ Network compose-spring-boot-server_default       Removed                                                                                                                                                                     0.3s
PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker compose ps
NAME      IMAGE     COMMAND   SERVICE   CREATED   STATUS    PORTS
PS C:\Users\admin\IdeaProjects\compose-spring-boot-server> docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES



참고링크 : https://www.inflearn.com/course/%EB%B9%84%EC%A0%84%EA%B3%B5%EC%9E%90-docker-%EC%9E%85%EB%AC%B8-%EC%8B%A4%EC%A0%84?cid=334085

 

비전공자도 이해할 수 있는 Docker 입문/실전| JSCODE 박재성 - 인프런 강의

현재 평점 4.9점 수강생 14,488명인 강의를 만나보세요. 비전공자 입장에서도 쉽게 이해할 수 있고, 실전에서 바로 적용 가능한 Docker 입문/실전 강의를 만들어봤습니다! Docker 기본 개념, Spring Boot를

www.inflearn.com

댓글