Docker Practice 3: fig builds mediawiki

Source: Internet
Author: User
Tags mediawiki

Docker Practice 3: fig builds mediawiki

Fig, fig. The fig project originated from docker and can be considered as a tool to quickly build a Docker-based isolated development environment.

1. Install fig

$ mkdir docker; cd docker$ curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > fig$ sudo chmod +x fig; sudo mv /usr/local/bin/

2. Build mediawiki

 

Run the following command in the docker directory:

 

$ git clone https://github.com/bopjiang/wikimedia-docker.git$ cd wikimedia-docker$ fig up -d

 

 

r$ docker psCONTAINER ID        IMAGE                           COMMAND                CREATED             STATUS              PORTS                  NAMES21182a060c17        nickstenning/mediawiki:latest   "/usr/bin/mediawiki-   7 hours ago         Up 7 hours          0.0.0.0:8880->80/tcp   wikimediadocker_wiki2_1   728ec09c3552        mysql:5.7.5                     "/entrypoint.sh mysq   7 hours ago         Up 7 hours          3306/tcp               wikimediadocker_db_1    

 

Iii. fig. yml

Fig. yml is used to configure the specific content of image building. The content of fig. yml in this wiki is in the wikimedia-docker directory. The content is as follows:

 

wiki2:    image: 'nickstenning/mediawiki'    ports:        - "8880:80"    links:        - db:database    volumes:        - /data/wiki2:/datadb:    image: "mysql:5.7.5"    expose:        - "3306"    environment:        - MYSQL_ROOT_PASSWORD=defaultpass
Image: used to specify the image. If the image does not exist locally, fig will try to use the remote pull image.

Links: connect to the container in other services.

Volumes: volume mount path. The/data/directory in the container is mounted to/data/wiki2 of the host. After the wiki configuration is complete, place the LocalSettings. php file in the/data/wiki2 directory of the host.

Expose: it is also an exposed port. The difference with ports is that the port is not published to the host machine and only accessed by the connected service.

Environment: Set environment variables.

Iv. wiki Configuration

Enter localhost: 8880 in the browser. The configuration page will be displayed when the system is started for the first time. Generate the LocalSettings. php file. You can also configure it directly in this configuration file.

5. wiki usage skills

1. configuration in the left-side Navigation Pane

6. Save container and import

 

sudo docker commit 9ab6e234c9ba linc-wikisudo docker images REPOSITORY               TAG                 IMAGE ID            CREATED             VIRTUAL SIZE linc-wiki                latest              b5a1e34b01c2        14 seconds ago      689.7 MBsudo docker export 9ab6e234c9ba > /home/linc/docker/images-bk/linc-wiki-export.tarsudo docker save linc-wiki > ../images-bk/linc-wiki-save.tar$ du -sh *495M    linc-wiki-export.tar672M    linc-wiki-save.tarsudo cat /home/linc/docker/images-bk/linc-wiki-export.tar | sudo docker import - docker_hgwebsudo docker load --input ../images-bk/linc-wiki-save.tar

 

 

Appendix:

1. fig Error Reporting and Solution

 

Fig running error:

$ fig upCouldn't connect to Docker daemon at http:/ - is it running?If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Fix it:

 

1) Change the DOCKER_OPTS in /etc/default/docker to:DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"2) Restart dockersudo restart docker3) Make sure that docker is running on localhost:4243 $ netstat -ant  |grep 4243tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN4) Set DOCKER_HOST (.bashrc)export DOCKER_HOST=tcp://localhost:4243$ echo $DOCKER_HOSTtcp://localhost:4243 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.