/ ghost

DockerのGhostにlocalhost:2368で接続できない

さくっと試すつもりでghostのdockerをrunしたら接続できなかった...

docker run -d --name some-ghost ghost

した後に、ホスト側のブラウザで

http://localhost:2368/

したのだけど表示されないのでdocker logsを確認

docker logs dev_ghost_1
[2018-07-22 08:47:46] INFO Creating table: posts 
[2018-07-22 08:47:46] INFO Creating table: users 
[2018-07-22 08:47:46] INFO Creating table: posts_authors 
[2018-07-22 08:47:46] INFO Creating table: roles 
[2018-07-22 08:47:46] INFO Creating table: roles_users 
[2018-07-22 08:47:46] INFO Creating table: permissions 
[2018-07-22 08:47:46] INFO Creating table: permissions_users 
[2018-07-22 08:47:46] INFO Creating table: permissions_roles 
[2018-07-22 08:47:46] INFO Creating table: permissions_apps 
[2018-07-22 08:47:46] INFO Creating table: settings 
[2018-07-22 08:47:46] INFO Creating table: tags 
[2018-07-22 08:47:46] INFO Creating table: posts_tags 
[2018-07-22 08:47:46] INFO Creating table: apps 
[2018-07-22 08:47:46] INFO Creating table: app_settings 
[2018-07-22 08:47:47] INFO Creating table: app_fields 
[2018-07-22 08:47:47] INFO Creating table: clients 
[2018-07-22 08:47:47] INFO Creating table: client_trusted_domains 
[2018-07-22 08:47:47] INFO Creating table: accesstokens 
[2018-07-22 08:47:47] INFO Creating table: refreshtokens 
[2018-07-22 08:47:47] INFO Creating table: subscribers 
[2018-07-22 08:47:47] INFO Creating table: invites 
[2018-07-22 08:47:47] INFO Creating table: brute 
[2018-07-22 08:47:47] INFO Creating table: webhooks 
[2018-07-22 08:47:47] INFO Model: Tag 
[2018-07-22 08:47:47] INFO Model: Client 
[2018-07-22 08:47:47] INFO Model: Role 
[2018-07-22 08:47:47] INFO Model: Permission 
[2018-07-22 08:47:47] INFO Model: User 
[2018-07-22 08:47:47] INFO Model: Post 
[2018-07-22 08:47:48] INFO Relation: Role to Permission 
[2018-07-22 08:47:48] INFO Relation: Post to Tag 
[2018-07-22 08:47:48] INFO Relation: User to Role 
[2018-07-22 08:47:48] INFO Finished database migration! 
[2018-07-22 08:47:51] WARN Theme's file locales/en.json not found. 
[2018-07-22 08:47:52] INFO Ghost is running in production... 
[2018-07-22 08:47:52] INFO Your blog is now available on http://localhost:2368/ 
[2018-07-22 08:47:52] INFO Ctrl+C to shut down 
[2018-07-22 08:47:52] INFO Ghost boot 3.195s 

動いてるように見える
でも

Your blog is now available on http://localhost:2368/ 

はホスト側からは確認できません
でもコンテナ内からなら上手くいきます

ここまでで原因はネットワークアダプタです
とりあえず接続できればいいので、コンテナのIPを調べます

docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
78346ad0e919        ghost:1-alpine      "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes        2368/tcp               dev_ghost_1

sandbox@sandbox-virtual-machine ~/project/docker/xxx.com/dev $ docker exec -it 78346ad0e919 /bin/bash
bash-4.3# ls
config.development.json  content                  current
config.production.json   content.orig             versions
bash-4.3# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:40:A0:10:00:02  
          inet addr:172.19.0.2  Bcast:172.19.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:82 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:16971 (16.5 KiB)  TX bytes:2647 (2.5 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:652 (652.0 B)  TX bytes:652 (652.0 B)

なので、ホスト側からは下記で確認できます

http://172.19.0.2:2368/
zienchan

zienchan

ハードウェアからソフトウェアまで広範囲で何か作ってます

Read More
DockerのGhostにlocalhost:2368で接続できない
Share this