因此,我在笔记本电脑上使用 vagrant 完成了 3 节点核心操作系统设置。我正在关注他们的快速入门指南。https://coreos.com/docs/quickstart/。
现在,当我运行 hello.service 并检查它的状态时,它告诉我该服务处于非活动状态/已死。
core@core-02 ~ $ fleetctl status hello.service
● \x22hello.service\x22.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
虽然日志和 docker ps 输出似乎暗示一切正常:
core@core-02 ~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b338ba5085b busybox:latest "/bin/sh -c 'while t 2 minutes ago Up 2 minutes hello
core@core-02 ~ $ fleetctl journal hello.service
-- Logs begin at Wed 2015-06-17 08:23:20 , end at Wed 2015-06-17 11:27:48 . --
Jun 17 11:27:39 core-02 docker[3296]: Hello World
Jun 17 11:27:40 core-02 docker[3296]: Hello World
Jun 17 11:27:41 core-02 docker[3296]: Hello World
Jun 17 11:27:42 core-02 docker[3296]: Hello World
Jun 17 11:27:43 core-02 docker[3296]: Hello World
Jun 17 11:27:44 core-02 docker[3296]: Hello World
Jun 17 11:27:45 core-02 docker[3296]: Hello World
Jun 17 11:27:46 core-02 docker[3296]: Hello World
Jun 17 11:27:47 core-02 docker[3296]: Hello World
Jun 17 11:27:48 core-02 docker[3296]: Hello World
知道我的环境做错了什么吗?TIA。这是 hello.service:
core@core-02 ~ $ cat hello.service
[Unit]
Description=My Service
After=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill hello
ExecStartPre=-/usr/bin/docker rm hello
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run --name hello busybox /bin/sh -c "while true; do echo Hello World; sleep 1; done"
ExecStop=/usr/bin/docker stop hello