Run docker containers

The following commands are available in Kisphp Bash Tool for an easier execution:

Run php project in Docker

docker run \
    --rm \
    -p "8080:8080" \
    -v $(pwd):/project \
    -w /project \
    -it registry.gitlab.com/marius-rizac/ci-registry/php7.1:latest \
    /bin/bash -c "php -S 0.0.0.0:8080 -t web"

MySQL container (Available as: kp mysql)

docker run \
    -p "3306:3306" \
    -e MYSQL_DATABASE=kisphp \
    -e MYSQL_ROOT_PASSWORD=kisphp \
    -e MYSQL_USER=kisphp \
    -e MYSQL_PASSWORD=kisphp \
    --name docker_mysql \
    -it mysql:5.7

Connection: Host: localhost Port: 3306 User: root or kisphp Password: kisphp Database Name: kisphp

PhpMyAdmin (Available as: kp mysql admin)

docker run --rm \
    --name myadmin \
    -e PMA_HOST=docker_mysql \
    -p "8888:80" \
    --link docker_mysql:docker_mysql \
    phpmyadmin/phpmyadmin
It will connect to previous mysql container with the credentials from mysql container configuration

Run phpmyadmin that connects to a remote server

docker run \
	--rm \
    -e PMA_HOST=<remove_server_ip> \
    -p "8888:80" \
    phpmyadmin/phpmyadmin
Then open url http://localhost:8888 in browser

Postgres 10 (Available as: kp postgres)

docker run \
        --name docker_postgres \
        -e POSTGRES_PASSWORD=kisphp \
        -e POSTGRES_DB=kisphp \
        -p "5432:5432" \
        postgres:10

PgAdmin 4 (Available as: kp postgres admin)

docker run \
        -p "8880:80" \
        -e "PGADMIN_DEFAULT_EMAIL=admin@example.com" \
        -e "PGADMIN_DEFAULT_PASSWORD=kisphp" \
        --link docker_postgres \
        dpage/pgadmin4

To connect to pgadmin 4, use email address and password provided in run command. To connect to postgres 10, use the following credentials: server: docker_postgres, username: postgres, password: kisphp

Redis container (Available as: kp redis)

docker run -p "6379:6379" -it redis:latest --name docker_redis
Connect to localhost:6379

Elasticsearch

docker run -p "9200:9200" --rm --name docker_es -it elasticsearch:latest
Check connection: curl localhost:9200

Kibana connect to previous elastic search container

docker run \
    --rm \
    --name docker_kibana \
    -p "5601:5601" \
    -e ELASTICSEARCH_URL=http://docker_es:9200 \
    -u 0 \
    --link docker_es:docker_es \
    -it kibana:latest

NPM

docker run \
    --rm \
    -v ~/.ssh:/root/.ssh \
    -v ~/.composer:/root/.composer \
    --name docker_npm6 \
    -it node:6 \
    sh -c "npm install"