29.Docker Compose CLI - Create Command

Creates containers for a service.

create docker-compose.yml with following content

version: "3.9"
    build: .
      - "8000:5000"
    image: "redis:alpine"

Creates containers for a service.

➜  7-DC-CLI git:(main) ✗ docker compose create 
[+] Running 7/7
 ⠿ redis Pulled                                                                                                                                                                      6.1s
   ⠿ af6eaf76a39c Already exists                                                                                                                                                     0.0s
   ⠿ 5015c79ed515 Pull complete                                                                                                                                                      0.9s
   ⠿ 2ca28624189f Pull complete                                                                                                                                                      1.0s
   ⠿ 4691452befb1 Pull complete                                                                                                                                                      1.6s
   ⠿ 746fa87aff8c Pull complete                                                                                                                                                      2.1s
   ⠿ b8496ad2d107 Pull complete                                                                                                                                                      2.2s
WARN[0006] Found orphan containers ([7-dc-cli-client-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] Running 2/2
 ⠿ Container 7-dc-cli-redis-1  Created                                                                                                                                               0.1s
 ⠿ Container 7-dc-cli-web-1    Recreated                                                                                                                                             0.1s
➜  7-DC-CLI git:(main)

© 2019-2023 @CloudNativeFolks | Documentation Distributed under Apache 2.0 License.

© 2023 Happy to help you with your Cloud Native Journey.