Help us understand the problem. What is going on with this article?

再起動後もコンテナを自動起動する

More than 3 years have passed since last update.

参考: AWS+CoreOS+Dockerでコンテナの自動起動 1 - Qiita

coreosにて確認。

このやり方だとなんでも出来ますね。

/etc/systemd/system/docker1.serviceファイルを作成

/etc/systemd/system/docker1.service
[Unit]
Description=docker1
After=docker.service
Requires=docker.service

[Service]
ExecStart=/usr/bin/docker start dbde0d684c85

[Install]
WantedBy=multi-user.target
$ sudo systemctl enable docker1
ln -s '/etc/systemd/system/docker1.service' '/etc/systemd/system/multi-user.target.wants/docker1.service'
一覧確認
ls -l /etc/systemd/system/multi-user.target.wants/docker*

再起動後も自動起動することを確認。

コンテナ間でlinkしている場合

例: nginxコンテナ が rails にリンクしている場合、
railsから先に立ち上げないとnginxコンテナの起動ができない。

ダメな例
ExecStart=/usr/bin/docker start nginxのCID railsのCID
良い例
ExecStart=/usr/bin/docker start railsのCID nginxのCID
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away