我创建了docker-registry.service文件,如下所示:
[Unit]
description=DockerRegistry
After=docker.service network.target
[Service]
WorkingDirectory=/docker-registry
ExecStart=/usr/local/bin/docker-compose up
Restart=on-failure
[Install]
WantedBy=multi-user.target
然而,当我使用以下命令运行服务时:
service docker-registry start
我明白了:
docker-registry: unrecognized service
如果我尝试以下:
systemctl start docker-registry
我明白了:
Failed to start docker-registry.service: Unknown unit: docker-registry.service
See system logs and 'systemctl status docker-registry.service' for details.
请建议。
修改 我在虚拟机中使用systemd。