Nice! You can remove that meta
attribute from you Nomad client now if you want. Nomad should retrieve the right image now.
From your service name, I’m assuming you are trying to run this Piwigo project. I don’t know much about it, but I was able to run the web install using this job:
job "piwigo" {
datacenters = ["dc1"]
group "piwigo" {
task "piwigo" {
driver = "docker"
config {
image = "linuxserver/piwigo:11.4.0-ls112"
ports = ["web"]
}
}
network {
mode = "bridge"
port "web" {
to = 80
}
}
service {
name = "piwigo"
port = "80"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "mysql"
local_bind_port = 3306
}
}
}
}
}
}
group "mysql" {
task "mysql" {
driver = "docker"
config {
image = "mysql:5.7"
ports = ["mysql"]
}
env {
MYSQL_ROOT_PASSWORD = "root"
MYSQL_DATABASE = "piwigo"
MYSQL_USER = "piwigo"
MYSQL_PASSWORD = "piwigo"
}
}
network {
mode = "bridge"
port "mysql" {
to = 3306
}
}
service {
name = "mysql"
port = "3306"
connect {
sidecar_service {}
}
}
}
}
Please note that this was just a test and you will most likely need to work a bit more on it
To connect to the database I had to use 127.0.0.1
instead of localhost
. It seems like the PHP client for MySQL treats these two values as different things:
Note :
Whenever you specify “localhost” or “localhost:port” as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use “127.0.0.1” instead of “localhost”. If the MySQL client library tries to connect to the wrong local socket, you should set the correct path as in your PHP configuration and leave the server field blank.
(source: PHP: mysql_connect - Manual)
Try using 127.0.0.1
instead of localhost
and see if that works for you.