LoginSignup
0
0

More than 5 years have passed since last update.

fuelphp on dockerめも

Last updated at Posted at 2018-02-07

プロジェクトの作成

$ oil create fuel-sample

ビルドインサーバ起動

$ oil create fuel-sample
$ cd /Users/user_name/fuel-sample
$ php oil server -h=0.0.0.0 -p=8080

Dockerのポート

ports:
 - "ホスト側のポート:コンテナ側のポート"
 -  ports: 
   - "80:8080"

例えばこの例だとdockerで8080でfuelを起動するとhttp://localhost:80
でアクセスできる。

dbへのアクセス

docker-compose.ymlが

version: "3"
services:
    www:
        container_name: fuel_app
        # build: .
        build: ./run_anyway        
        ports: 
            - "80:8080"
        volumes:
            # - ./www:/var/www/html/
            - ../application/:/var/www/html/application
            # - ./environment/config/php.ini /usr/local/etc/php/php.ini
            # - ./environment/config/ssh2.ini /etc/php.d/ssh2.ini
            # - ./environment/config/httpd.conf /etc/httpd/conf/httpd.conf
        tty: true

    db:
        container_name: docker_db_mysql
        image: mysql
        ports: 
            - "3306:3306"
        restart: always
        environment:
            MYSQL_USER: user
            MYSQL_PASSWORD: test
            MYSQL_ROOT_PASSWORD: root
        volumes:
            # - "./mysql:/var/lib/mysql"
            - "./mysql/init:/docker-entrypoint-initdb.d"

となっている時、プログラム内でdbにアクセスする際localhostとなっているところをdbに置換する。
wwwやdbはエイリアスとなっているのでコンテナ間のアクセスはリンクを使用する。
https://stackoverflow.com/questions/40075065/using-docker-i-get-the-error-sqlstatehy000-2002-no-such-file-or-directory

Refferences

fuelPHP
https://qiita.com/snoguchi/items/47392806f898671baa22
vim高速移動
https://qiita.com/takeharu/items/9d1c3577f8868f7b07b5
DockerでfuelPHP
https://qiita.com/TakashiOshikawa/items/8b73fce98d0d55f86936

0
0
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
0
0