1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DockerでWordPressを動かす

Posted at

Docker初心者の自分がDockerを入れてまずやりました。
備忘です。

MySQLのインストール+起動

docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:5.7

WordPressのインストール+起動

docker run --name some-wordpress -e WORDPRESS_DB_PASSWORD=my-secret-pw --link some-mysql:mysql -d -p 8080:80 wordpress

http://localhost:8080/にアクセス

簡単にワードプレスが動きます。
※下の画像はいろいろ動かしたあとの状態。
image.png

[コマンドオプション]
--name:コンテナに名前をつける
-e:環境変数を指定して実行
-d:バックグラウンドで実行
-p:ポートマップ、ホストとコンテナ間のポートフォワード設定。
 基本的には、「-p <ホスト側のポート>:<コンテナ側のポート>」で書きます。
-link:コンテナ同士を紐付ける
-v:オプションでホストの任意のパスをコンテナの任意のパスにマウント
-it:コンテナにログインする

所感

Docker簡単に動き過ぎて怖い。。
これは将来インフラエンジニア要らなくなるのではとの危機感感じました。

参考リンク

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?