我有一个包含一个简单网页的docker映像。它可以正常工作:
docker run -p 747:747 <docker image name>
我还写了一份游牧工作来获取docker镜像并运行它:
job "example" {
datacenters = ["dc1"]
type = "service"
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "3m"
progress_deadline = "10m"
auto_revert = false
canary = 0
}
migrate {
max_parallel = 1
health_check = "checks"
min_healthy_time = "10s"
healthy_deadline = "5m"
}
group "web" {
count = 1
restart {
# The number of attempts to run the job within the specified interval.
attempts = 2
interval = "30m"
delay = "15s"
mode = "fail"
}
ephemeral_disk {
size = 300
}
task "redis" {
driver = "docker"
config {
image = "mahdijalilvand/docker_web:latest"
port_map {
http = 747
}
command = "python"
args = ["/app/app/app.py"]
}
resources {
cpu = 500 # 500 MHz
memory = 1024 # 1024MB
network {
mbits = 10
port "db" {}
}
}
service {
name = "redis-cache"
tags = ["global", "cache"]
port = "db"
check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
}
}
}
但我无权访问该网页。