Ghost’s docker Mirror Mapping Port is Invalid

  docker, question

system environment

  • ubuntu 14.04 64bit
  • docker 1.6.0
  • Ghost mirror


  1. Download ghost&& Make ghost Images Yourself
  2. docker run -it -p ghost bash
  3. Npm start started ghost successfully.
  4. Another shelldocker ps -a
adolph@geek:~$ docker ps -a
 CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                       NAMES
 84802ccaa8f7        ghost:latest        "/ bash   32 seconds ago      Up 31 seconds>2368/tcp   kickass_bell

Problem description

Enter in browserlocalhost:32769Cannot connect to resource after

I want to know what it is except the problem.

Ghost’s Dockerfile

shell#build ghost image
 FROM adolphlwq/ubuntu:14.04_64_base_image
 MAINTAINER adolphlwq  < >
 RUN apt-get update && apt-get -yqq upgrade
 #install node
 RUN apt-get install -yqq nodejs npm wget unzip
 RUN ln -s /usr/bin/nodejs /usr/bin/node
 #install ghost-zh
 RUN cd /opt/ && wget && unzip -uo -d ghost && rm
 #initial ghost
 RUN cd /opt/ghost && npm install --production
 WORKDIR /opt/ghost/
 #expose port 2368
 EXPOSE 2368
 CMD npm start

Then I looked at ghost’s mirror Dockerfile on the Daocloud. The core is similar. I don’t know what my problem is. Port mapping has been failing all the time.
Dockerfile for ghost on daocloud

There are under ghost file directoryconfig.example.jsThe file is used to configure relevant parameters:

config = {
 // ### Production
 // When running Ghost in the wild, use the production environment.
 // Configure your URL and mail settings here
 production: {
 server: {
 host: '',
 port: '2368'

The crux of the problem lies inserverThe configuration of the item. The default islocalhostIt seems that the default localhost for general hosts corresponds to (you can also/etc/hostsRevision). Localhost is a fake ip that can only be accessed locally.*Can match any ip.See this answer for details..

Therefore, you should modify the configuration item of config.example.js and change the server binding address to0.0.0.0Just do it.

Finally, I also made a ghost docker image, and also used nginx to configure the agent. UsedLet’s EncryptEncryption https, you can refer to the following: