gpt4 book ai didi

Docker Compose 到 CoreOS

转载 作者:IT老高 更新时间:2023-10-28 12:35:29 27 4
gpt4 key购买 nike

我目前正在学习 Docker,并制作了一个简单易用的 Docker Compose 设置。 3 个容器,都有自己的 Dockerfile 设置。我如何才能将其转换为在 CoreOS 上工作,以便稍后设置集群?

web:
build: ./app
ports:
- "3030:3000"
links:
- "redis"

newrelic:
build: ./newrelic
links:
- "redis"

redis:
build: ./redis
ports:
- "6379:6379"
volumes:
- /data/redis:/data

最佳答案

取自 https://docs.docker.com/compose/install/

唯一的问题是/usr 是只读的,但/opt/bin 是可写的并且在路径中,所以:

sd-xx~ # mkdir /opt/
sd-xx~ # mkdir /opt/bin
sd-xx~ # curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 403 0 403 0 0 1076 0 --:--:-- --:--:-- --:--:-- 1080
100 7990k 100 7990k 0 0 2137k 0 0:00:03 0:00:03 --:--:-- 3176k
sd-xx~ # chmod +x /opt/bin/docker-compose

sd-xx~ # docker-compose
Define and run multi-container applications with Docker.

Usage:
docker-compose [options] [COMMAND] [ARGS...]
docker-compose -h|--help

Options:
-f, --file FILE Specify an alternate compose file (default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name (default: directory name)
--verbose Show more output
-v, --version Print version and exit

Commands:
build Build or rebuild services
help Get help on a command
kill Kill containers
logs View output from containers
port Print the public port for a port binding
ps List containers
pull Pulls service images
restart Restart services
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
up Create and start containers
migrate-to-labels Recreate containers to add labels

关于Docker Compose 到 CoreOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29086918/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com