From 8925315ef817151c88a21567707e7d7919adc0c8 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 4 Mar 2019 17:15:55 -0800 Subject: [PATCH 1/2] Ditch a lot of "--link" examples (using "--network some-network" instead to force users to do more homework) --- cassandra/content.md | 22 +++------------------- drupal/content.md | 14 +++++++------- mariadb/content.md | 20 +++++--------------- memcached/content.md | 12 ++---------- mongo-express/content.md | 5 +++-- mongo/content.md | 10 +++++----- mysql/content.md | 16 ++++------------ percona/content.md | 16 +++------------- postgres/content.md | 8 +------- rabbitmq/content.md | 14 ++++---------- redis/content.md | 10 ++-------- redmine/content.md | 10 +++++----- wordpress/content.md | 18 +++++++++--------- 13 files changed, 53 insertions(+), 122 deletions(-) diff --git a/cassandra/content.md b/cassandra/content.md index dbcd55b3eaa6..7467c6eee970 100644 --- a/cassandra/content.md +++ b/cassandra/content.md @@ -18,14 +18,6 @@ $ docker run --name some-%%REPO%% -d %%IMAGE%%:tag ... where `some-%%REPO%%` is the name you want to assign to your container and `tag` is the tag specifying the Cassandra version you want. See the list above for relevant tags. -## Connect to Cassandra from an application in another Docker container - -This image exposes the standard Cassandra ports (see the [Cassandra FAQ](https://wiki.apache.org/cassandra/FAQ#ports)), so container linking makes the Cassandra instance available to other application containers. Start your application container like this in order to link it to the Cassandra container: - -```console -$ docker run --name some-app --link some-%%REPO%%:%%REPO%% -d app-that-uses-cassandra -``` - ## Make a cluster Using the environment variables documented below, there are two cluster scenarios: instances on the same machine and instances on separate machines. For the same machine, start the instance as described above. To start other instances, just tell each new node where the first is. @@ -36,10 +28,10 @@ $ docker run --name some-%%REPO%%2 -d -e CASSANDRA_SEEDS="$(docker inspect --for ... where `some-%%REPO%%` is the name of your original Cassandra Server container, taking advantage of `docker inspect` to get the IP address of the other container. -Or you may use the docker run --link option to tell the new node where the first is: +Or you may use Docker networks to tell the new node where the first is: ```console -$ docker run --name some-cassandra2 -d --link some-cassandra:cassandra %%IMAGE%%:tag +$ docker run --name some-cassandra2 -d --network some-network %%IMAGE%%:tag ``` For separate machines (ie, two VMs on a cloud provider), you need to tell Cassandra what IP address to advertise to the other nodes (since the address of the container is behind the docker bridge). @@ -61,17 +53,9 @@ $ docker run --name some-%%REPO%% -d -e CASSANDRA_BROADCAST_ADDRESS=10.43.43.43 The following command starts another Cassandra container instance and runs `cqlsh` (Cassandra Query Language Shell) against your original Cassandra container, allowing you to execute CQL statements against your database instance: ```console -$ docker run -it --link some-%%REPO%%:cassandra --rm %%IMAGE%% sh -c 'exec cqlsh "$CASSANDRA_PORT_9042_TCP_ADDR"' +$ docker run -it --network some-network --rm %%IMAGE%% cqlsh some-cassandra ``` -... or (simplified to take advantage of the `/etc/hosts` entry Docker adds for linked containers): - -```console -$ docker run -it --link some-%%REPO%%:cassandra --rm %%IMAGE%% cqlsh cassandra -``` - -... where `some-%%REPO%%` is the name of your original Cassandra Server container. - More information about the CQL can be found in the [Cassandra documentation](https://cassandra.apache.org/doc/latest/cql/index.html). ## Container shell access and viewing Cassandra logs diff --git a/drupal/content.md b/drupal/content.md index 758280d9eacb..01bc190140f5 100644 --- a/drupal/content.md +++ b/drupal/content.md @@ -22,29 +22,29 @@ $ docker run --name some-%%REPO%% -p 8080:80 -d %%IMAGE%% Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser. -There are multiple database types supported by this image, most easily used via standard container linking. In the default configuration, SQLite can be used to avoid a second container and write to flat-files. More detailed instructions for different (more production-ready) database types follow. +There are multiple database types supported by this image, most easily used via Docker networks. In the default configuration, SQLite can be used to avoid a second container and write to flat-files. More detailed instructions for different (more production-ready) database types follow. When first accessing the webserver provided by this image, it will go through a brief setup process. The details provided below are specifically for the "Set up database" step of that configuration process. ## MySQL ```console -$ docker run --name some-%%REPO%% --link some-mysql:mysql -d %%IMAGE%% +$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%% ``` - Database type: `MySQL, MariaDB, or equivalent` - Database name/username/password: `
` (`MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_DATABASE`; see environment variables in the description for [`mysql`](https://hub.docker.com/_/mysql/)) -- ADVANCED OPTIONS; Database host: `mysql` (for using the `/etc/hosts` entry added by `--link` to access the linked container's MySQL instance) +- ADVANCED OPTIONS; Database host: `some-mysql` (for using the DNS entry added by `--network` to access the MySQL container) ## PostgreSQL ```console -$ docker run --name some-%%REPO%% --link some-postgres:postgres -d %%IMAGE%% +$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%% ``` - Database type: `PostgreSQL` - Database name/username/password: `
` (`POSTGRES_USER`, `POSTGRES_PASSWORD`; see environment variables in the description for [`postgres`](https://hub.docker.com/_/postgres/)) -- ADVANCED OPTIONS; Database host: `postgres` (for using the `/etc/hosts` entry added by `--link` to access the linked container's PostgreSQL instance) +- ADVANCED OPTIONS; Database host: `some-postgres` (for using the DNS entry added by `--network` to access the PostgreSQL container) ## Volumes @@ -61,7 +61,7 @@ $ docker run --rm %%IMAGE%% tar -cC /var/www/html/sites . | tar -xC /path/on/hos This can then be bind-mounted into a new container: ```console -$ docker run --name some-%%REPO%% --link some-postgres:postgres -d \ +$ docker run --name some-%%REPO%% --network some-network -d \ -v /path/on/host/modules:/var/www/html/modules \ -v /path/on/host/profiles:/var/www/html/profiles \ -v /path/on/host/sites:/var/www/html/sites \ @@ -74,7 +74,7 @@ Another solution using Docker Volumes: ```console $ docker volume create %%REPO%%-sites $ docker run --rm -v %%REPO%%-sites:/temporary/sites %%IMAGE%% cp -aRT /var/www/html/sites /temporary/sites -$ docker run --name some-%%REPO%% --link some-postgres:postgres -d \ +$ docker run --name some-%%REPO%% --network some-network -d \ -v %%REPO%%-modules:/var/www/html/modules \ -v %%REPO%%-profiles:/var/www/html/profiles \ -v %%REPO%%-sites:/var/www/html/sites \ diff --git a/mariadb/content.md b/mariadb/content.md index d837ddde7f85..c027256fe22c 100644 --- a/mariadb/content.md +++ b/mariadb/content.md @@ -20,27 +20,17 @@ $ docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%IMAGE ... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -## Connect to MySQL from an application in another Docker container - -Since MariaDB is intended as a drop-in replacement for MySQL, it can be used with many applications. - -This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: - -```console -$ docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql -``` - ## Connect to MariaDB from the MySQL command line client The following command starts another `%%IMAGE%%` container instance and runs the `mysql` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance: ```console -$ docker run -it --link some-%%REPO%%:mysql --rm %%IMAGE%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' +$ docker run -it --network some-network --rm %%IMAGE%% mysql -hsome-%%REPO%% -uexample-user -p ``` -... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container. +... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container (connected to the `some-network` Docker network). -This image can also be used as a client for non-Docker or remote MariaDB instances: +This image can also be used as a client for non-Docker or remote instances: ```console $ docker run -it --rm %%IMAGE%% mysql -hsome.mysql.host -usome-mysql-user -p @@ -60,7 +50,7 @@ The `docker exec` command allows you to run commands inside a Docker container. $ docker exec -it some-%%REPO%% bash ``` -The MariaDB Server log is available through Docker's container log: +The log is available through Docker's container log: ```console $ docker logs some-%%REPO%% @@ -68,7 +58,7 @@ $ docker logs some-%%REPO%% ## Using a custom MySQL configuration file -The MariaDB startup configuration is specified in the file `/etc/mysql/my.cnf`, and that file in turn includes any files found in the `/etc/mysql/conf.d` directory that end with `.cnf`. Settings in files in this directory will augment and/or override settings in `/etc/mysql/my.cnf`. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as `/etc/mysql/conf.d` inside the `%%IMAGE%%` container. +The startup configuration is specified in the file `/etc/mysql/my.cnf`, and that file in turn includes any files found in the `/etc/mysql/conf.d` directory that end with `.cnf`. Settings in files in this directory will augment and/or override settings in `/etc/mysql/my.cnf`. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as `/etc/mysql/conf.d` inside the `%%IMAGE%%` container. If `/my/custom/config-file.cnf` is the path and name of your custom configuration file, you can start your `%%IMAGE%%` container like this (note that only the directory path of the custom config file is used in this command): diff --git a/memcached/content.md b/memcached/content.md index 6bfb64644603..6f13f6942d9d 100644 --- a/memcached/content.md +++ b/memcached/content.md @@ -12,20 +12,12 @@ Memcached's APIs provide a very large hash table distributed across multiple mac $ docker run --name my-memcache -d %%IMAGE%% ``` -Start your memcached container with the above command and then you can connect you app to it with standard linking: - -```console -$ docker run --link my-memcache:memcache -d my-app-image -``` - -The memcached server information would then be available through the ENV variables generated by the link as well as through DNS as `memcache` from `/etc/hosts`. - -How to set the memory usage for memcached +## Setting Memory Usage ```console $ docker run --name my-memcache -d %%IMAGE%% memcached -m 64 ``` -This would set the memcache server to use 64 megabytes for storage. +This would set the Memcached server to use 64 megabytes for storage. For infomation on configuring your memcached server, see the extensive [wiki](https://github.com/memcached/memcached/wiki). diff --git a/mongo-express/content.md b/mongo-express/content.md index 35eb152e6ab7..13b6df497b75 100644 --- a/mongo-express/content.md +++ b/mongo-express/content.md @@ -9,7 +9,7 @@ mongo-express is a web-based MongoDB admin interface written in Node.js, Express # How to use this image ```console -$ docker run --link some_mongo_container:mongo -p 8081:8081 %%IMAGE%% +$ docker run --network some-network -e ME_CONFIG_MONGODB_SERVER=some-mongo -p 8081:8081 %%IMAGE%% ``` Then you can hit `http://localhost:8081` or `http://host-ip:8081` in your browser. @@ -54,10 +54,11 @@ The following are only needed if `ME_CONFIG_MONGODB_ENABLE_ADMIN` is **"false"** ```console $ docker run -it --rm \ + --network web_default \ --name mongo-express \ - --link web_db_1:mongo \ -p 8081:8081 \ -e ME_CONFIG_OPTIONS_EDITORTHEME="ambiance" \ + -e ME_CONFIG_MONGODB_SERVER="web_db_1" \ -e ME_CONFIG_BASICAUTH_USERNAME="user" \ -e ME_CONFIG_BASICAUTH_PASSWORD="fairly long password" \ %%IMAGE%% diff --git a/mongo/content.md b/mongo/content.md index 7e0516149beb..ffed4e040032 100644 --- a/mongo/content.md +++ b/mongo/content.md @@ -20,10 +20,10 @@ $ docker run --name some-%%REPO%% -d %%IMAGE%%:tag ## Connect to MongoDB from another Docker container -The MongoDB server in the image listens on the standard MongoDB port, `27017`, so connecting via container linking or Docker networks will be the same as connecting to a remote `mongod`. The following example starts another MongoDB container instance and runs the `mongo` command line client against the original MongoDB container from the example above, allowing you to execute MongoDB statements against your database instance: +The MongoDB server in the image listens on the standard MongoDB port, `27017`, so connecting via Docker networks will be the same as connecting to a remote `mongod`. The following example starts another MongoDB container instance and runs the `mongo` command line client against the original MongoDB container from the example above, allowing you to execute MongoDB statements against your database instance: ```console -$ docker run -it --link some-%%REPO%%:mongo --rm %%IMAGE%% mongo --host mongo test +$ docker run -it --network some-network --rm %%IMAGE%% mongo --host some-%%REPO%% test ``` ... where `some-%%REPO%%` is the name of your original `mongo` container. @@ -107,13 +107,13 @@ These variables, used in conjunction, create a new user and set that user's pass The following is an example of using these two variables to create a MongoDB instance and then using the `mongo` cli to connect against the `admin` authentication database. ```console -$ docker run -d --name some-%%REPO%% \ +$ docker run -d --network some-network --name some-%%REPO%% \ -e MONGO_INITDB_ROOT_USERNAME=mongoadmin \ -e MONGO_INITDB_ROOT_PASSWORD=secret \ %%IMAGE%% -$ docker run -it --rm --link some-%%REPO%%:mongo %%IMAGE%% \ - mongo --host mongo \ +$ docker run -it --rm --network some-network %%IMAGE%% \ + mongo --host some-mongo \ -u mongoadmin \ -p secret \ --authenticationDatabase admin \ diff --git a/mysql/content.md b/mysql/content.md index f0159ade78e1..d32fc27e5743 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -18,25 +18,17 @@ $ docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%IMAGE ... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -## Connect to MySQL from an application in another Docker container - -This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: - -```console -$ docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql -``` - ## Connect to MySQL from the MySQL command line client The following command starts another `%%IMAGE%%` container instance and runs the `mysql` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance: ```console -$ docker run -it --link some-%%REPO%%:mysql --rm %%IMAGE%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' +$ docker run -it --network some-network --rm %%IMAGE%% mysql -hsome-%%REPO%% -uexample-user -p ``` -... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container. +... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container (connected to the `some-network` Docker network). -This image can also be used as a client for non-Docker or remote MySQL instances: +This image can also be used as a client for non-Docker or remote instances: ```console $ docker run -it --rm %%IMAGE%% mysql -hsome.mysql.host -usome-mysql-user -p @@ -56,7 +48,7 @@ The `docker exec` command allows you to run commands inside a Docker container. $ docker exec -it some-%%REPO%% bash ``` -The MySQL Server log is available through Docker's container log: +The log is available through Docker's container log: ```console $ docker logs some-%%REPO%% diff --git a/percona/content.md b/percona/content.md index 05ef93123767..c3a03ef9351a 100644 --- a/percona/content.md +++ b/percona/content.md @@ -20,25 +20,15 @@ $ docker run --name some-%%REPO%% -e MYSQL_ROOT_PASSWORD=my-secret-pw -d %%IMAGE ... where `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MySQL root user and `tag` is the tag specifying the MySQL version you want. See the list above for relevant tags. -## Connect to MySQL from an application in another Docker container - -Since Percona Server for MySQL is intended as a drop-in replacement for MySQL, it can be used with many applications. - -This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container: - -```console -$ docker run --name some-app --link some-%%REPO%%:mysql -d application-that-uses-mysql -``` - -## Connect to Percona Server for MySQL from the command line client +## Connect to MariaDB from the MySQL command line client The following command starts another `%%IMAGE%%` container instance and runs the `mysql` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance: ```console -$ docker run -it --link some-%%REPO%%:mysql --rm %%IMAGE%% sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' +$ docker run -it --network some-network --rm %%IMAGE%% mysql -hsome-%%REPO%% -uexample-user -p ``` -... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container. +... where `some-%%REPO%%` is the name of your original `%%IMAGE%%` container (connected to the `some-network` Docker network). This image can also be used as a client for non-Docker or remote instances: diff --git a/postgres/content.md b/postgres/content.md index c598da69122e..340f14ad8a83 100644 --- a/postgres/content.md +++ b/postgres/content.md @@ -22,16 +22,10 @@ The default `postgres` user and database are created in the entrypoint with `ini > > [postgresql.org/docs](http://www.postgresql.org/docs/9.5/interactive/app-initdb.html) -## connect to it from an application - -```console -$ docker run --name some-app --link some-postgres:postgres -d application-that-uses-postgres -``` - ## ... or via `psql` ```console -$ docker run -it --rm --link some-postgres:postgres %%IMAGE%% psql -h postgres -U postgres +$ docker run -it --rm --network some-network %%IMAGE%% psql -h some-postgres -U postgres psql (9.5.0) Type "help" for help. diff --git a/rabbitmq/content.md b/rabbitmq/content.md index 64aec068face..032a9e9567f2 100644 --- a/rabbitmq/content.md +++ b/rabbitmq/content.md @@ -51,14 +51,14 @@ See the [RabbitMQ "Clustering Guide"](https://www.rabbitmq.com/clustering.html#e For setting a consistent cookie (especially useful for clustering but also for remote/cross-container administration via `rabbitmqctl`), use `RABBITMQ_ERLANG_COOKIE`: ```console -$ docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_ERLANG_COOKIE='secret cookie here' %%IMAGE%%:3 +$ docker run -d --hostname some-rabbit --name some-rabbit --network some-network -e RABBITMQ_ERLANG_COOKIE='secret cookie here' %%IMAGE%%:3 ``` This can then be used from a separate instance to connect: ```console -$ docker run -it --rm --link some-rabbit:my-rabbit -e RABBITMQ_ERLANG_COOKIE='secret cookie here' %%IMAGE%%:3 bash -root@f2a2d3d27c75:/# rabbitmqctl -n rabbit@my-rabbit list_users +$ docker run -it --rm --network some-network -e RABBITMQ_ERLANG_COOKIE='secret cookie here' %%IMAGE%%:3 bash +root@f2a2d3d27c75:/# rabbitmqctl -n rabbit@some-rabbit list_users Listing users ... guest [administrator] ``` @@ -66,7 +66,7 @@ guest [administrator] Alternatively, one can also use `RABBITMQ_NODENAME` to make repeated `rabbitmqctl` invocations simpler: ```console -$ docker run -it --rm --link some-rabbit:my-rabbit -e RABBITMQ_ERLANG_COOKIE='secret cookie here' -e RABBITMQ_NODENAME=rabbit@my-rabbit %%IMAGE%%:3 bash +$ docker run -it --rm --network some-network -e RABBITMQ_ERLANG_COOKIE='secret cookie here' -e RABBITMQ_NODENAME=rabbit@some-rabbit %%IMAGE%%:3 bash root@f2a2d3d27c75:/# rabbitmqctl list_users Listing users ... guest [administrator] @@ -180,9 +180,3 @@ Additional configuration keys would be specified as a list. For example, configu ### Health/Liveness/Readiness Checking See [the "Official Images" FAQ](https://github.com/docker-library/faq#healthcheck) and [the discussion on docker-library/rabbitmq#174 (especially the large comment by Michael Klishin from RabbitMQ upstream)](https://github.com/docker-library/rabbitmq/pull/174#issuecomment-452002696) for a detailed explanation of why this image does not come with a default `HEALTHCHECK` defined, and for suggestions for implementing your own health/liveness/readiness checks. - -## Connecting to the daemon - -```console -$ docker run --name some-app --link some-rabbit:rabbit -d application-that-uses-rabbitmq -``` diff --git a/redis/content.md b/redis/content.md index 6c2d06142fa9..f1f3723ea803 100644 --- a/redis/content.md +++ b/redis/content.md @@ -24,16 +24,10 @@ If persistence is enabled, data is stored in the `VOLUME /data`, which can be us For more about Redis Persistence, see [http://redis.io/topics/persistence](http://redis.io/topics/persistence). -## connect to it from an application +## connecting via `redis-cli` ```console -$ docker run --name some-app --link some-redis:redis -d application-that-uses-redis -``` - -## ... or via `redis-cli` - -```console -$ docker run -it --link some-redis:redis --rm %%IMAGE%% redis-cli -h redis -p 6379 +$ docker run -it --network some-network --rm %%IMAGE%% redis-cli -h some-redis ``` ## Additionally, If you want to use your own redis.conf ... diff --git a/redmine/content.md b/redmine/content.md index 1a22deae8621..5f0d83958fae 100644 --- a/redmine/content.md +++ b/redmine/content.md @@ -20,26 +20,26 @@ $ docker run -d --name some-redmine %%IMAGE%% ## Run Redmine with a Database Container -Running Redmine with a database server is the recommened way. +Running Redmine with a database server is the recommended way. 1. start a database container - PostgreSQL ```console - $ docker run -d --name some-postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=redmine postgres + $ docker run -d --name some-postgres --network some-network -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=redmine postgres ``` - - MySQL (replace `--link some-postgres:postgres` with `--link some-mysql:mysql` when running redmine) + - MySQL (replace `-e REDMINE_DB_POSTGRES=some-postgres` with `-e REDMINE_DB_MYSQL=some-mysql` when running Redmine) ```console - $ docker run -d --name some-mysql -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=redmine mysql + $ docker run -d --name some-mysql --network some-network -e MYSQL_USER=redmine -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=redmine -e MYSQL_RANDOM_ROOT_PASSWORD=1 mysql:5.7 ``` 2. start redmine ```console - $ docker run -d --name some-%%REPO%% --link some-postgres:postgres %%IMAGE%% + $ docker run -d --name some-%%REPO%% --network some-network -e REDMINE_DB_POSTGRES=some-postgres -e REDMINE_DB_USERNAME=redmine -e REDMINE_DB_PASSWORD=secret %%IMAGE%% ``` ## %%STACK%% diff --git a/wordpress/content.md b/wordpress/content.md index 1bc6da72ac2d..d9ee7b08875e 100644 --- a/wordpress/content.md +++ b/wordpress/content.md @@ -9,17 +9,17 @@ WordPress is a free and open source blogging tool and a content management syste # How to use this image ```console -$ docker run --name some-%%REPO%% --link some-mysql:mysql -d %%IMAGE%% +$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%% ``` The following environment variables are also honored for configuring your WordPress instance: -- `-e WORDPRESS_DB_HOST=...` (defaults to the IP and port of the linked `mysql` container) -- `-e WORDPRESS_DB_USER=...` (defaults to "root") -- `-e WORDPRESS_DB_PASSWORD=...` (defaults to the value of the `MYSQL_ROOT_PASSWORD` environment variable from the linked `mysql` container) -- `-e WORDPRESS_DB_NAME=...` (defaults to "wordpress") -- `-e WORDPRESS_TABLE_PREFIX=...` (defaults to "", only set this when you need to override the default table prefix in wp-config.php) -- `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` (default to unique random SHA1s) +- `-e WORDPRESS_DB_HOST=...` +- `-e WORDPRESS_DB_USER=...` +- `-e WORDPRESS_DB_PASSWORD=...` +- `-e WORDPRESS_DB_NAME=...` +- `-e WORDPRESS_TABLE_PREFIX=...` +- `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` (default to unique random SHA1s, but only if other environment variable configuration is provided) - `-e WORDPRESS_DEBUG=1` (defaults to disabled, non-empty value will enable `WP_DEBUG` in `wp-config.php`) - `-e WORDPRESS_CONFIG_EXTRA=...` (defaults to nothing, non-empty value will be embedded verbatim inside `wp-config.php` -- especially useful for applying extra configuration values this image does not provide by default such as `WP_ALLOW_MULTISITE`; see [docker-library/wordpress#142](https://github.com/docker-library/wordpress/pull/142) for more details) @@ -28,12 +28,12 @@ If the `WORDPRESS_DB_NAME` specified does not already exist on the given MySQL s If you'd like to be able to access the instance from the host without the container's IP, standard port mappings can be used: ```console -$ docker run --name some-%%REPO%% --link some-mysql:mysql -p 8080:80 -d %%IMAGE%% +$ docker run --name some-%%REPO%% -p 8080:80 -d %%IMAGE%% ``` Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser. -If you'd like to use an external database instead of a linked `mysql` container, specify the hostname and port with `WORDPRESS_DB_HOST` along with the password in `WORDPRESS_DB_PASSWORD` and the username in `WORDPRESS_DB_USER` (if it is something other than `root`): +If you'd like to use an external database instead of a `mysql` container, specify the hostname and port with `WORDPRESS_DB_HOST` along with the password in `WORDPRESS_DB_PASSWORD` and the username in `WORDPRESS_DB_USER` (if it is something other than `root`): ```console $ docker run --name some-%%REPO%% -e WORDPRESS_DB_HOST=10.1.2.3:3306 \ From 1da9a5c37478f126d863c8a46716e7125bb0ace9 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 14 Mar 2019 16:42:54 -0700 Subject: [PATCH 2/2] Update Cassandra with Joe's suggestions --- cassandra/content.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cassandra/content.md b/cassandra/content.md index 7467c6eee970..c1b9b91df5de 100644 --- a/cassandra/content.md +++ b/cassandra/content.md @@ -13,7 +13,7 @@ Apache Cassandra is an open source distributed database management system design Starting a Cassandra instance is simple: ```console -$ docker run --name some-%%REPO%% -d %%IMAGE%%:tag +$ docker run --name some-%%REPO%% --network some-network -d %%IMAGE%%:tag ``` ... where `some-%%REPO%%` is the name you want to assign to your container and `tag` is the tag specifying the Cassandra version you want. See the list above for relevant tags. @@ -23,15 +23,7 @@ $ docker run --name some-%%REPO%% -d %%IMAGE%%:tag Using the environment variables documented below, there are two cluster scenarios: instances on the same machine and instances on separate machines. For the same machine, start the instance as described above. To start other instances, just tell each new node where the first is. ```console -$ docker run --name some-%%REPO%%2 -d -e CASSANDRA_SEEDS="$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' some-%%REPO%%)" %%IMAGE%%:tag -``` - -... where `some-%%REPO%%` is the name of your original Cassandra Server container, taking advantage of `docker inspect` to get the IP address of the other container. - -Or you may use Docker networks to tell the new node where the first is: - -```console -$ docker run --name some-cassandra2 -d --network some-network %%IMAGE%%:tag +$ docker run --name some-%%REPO%%2 -d --network some-network -e CASSANDRA_SEEDS=some-%%REPO%% %%IMAGE%%:tag ``` For separate machines (ie, two VMs on a cloud provider), you need to tell Cassandra what IP address to advertise to the other nodes (since the address of the container is behind the docker bridge). @@ -53,7 +45,7 @@ $ docker run --name some-%%REPO%% -d -e CASSANDRA_BROADCAST_ADDRESS=10.43.43.43 The following command starts another Cassandra container instance and runs `cqlsh` (Cassandra Query Language Shell) against your original Cassandra container, allowing you to execute CQL statements against your database instance: ```console -$ docker run -it --network some-network --rm %%IMAGE%% cqlsh some-cassandra +$ docker run -it --network some-network --rm %%IMAGE%% cqlsh some-%%REPO%% ``` More information about the CQL can be found in the [Cassandra documentation](https://cassandra.apache.org/doc/latest/cql/index.html).