Skip to content

Instantly share code, notes, and snippets.

@etoews
Last active May 31, 2016 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etoews/56ea07d9eaf0c350912b26ec9d27acea to your computer and use it in GitHub Desktop.
Save etoews/56ea07d9eaf0c350912b26ec9d27acea to your computer and use it in GitHub Desktop.

Sign up for Carina

In the Carina Control Panel (the other tab), sign up for Carina.

⭐️ You only get one chance to enter your email address and password so be exact! ⭐️

Create your cluster

Click Add Cluster and name it mycluster

Get your API Key

In the Carina Control Panel (the other tab)

  1. Click your username in the top-right corner
  2. Click API Key
  3. Copy the API Key (Command-C)

Configure and use the Carina CLI

In the terminal below

Set your environment variables to contain these credentials

$ export CARINA_USERNAME=<email>
$ export CARINA_APIKEY=<apikey>

$ eval $(carina env mycluster)

$ carina ls
ClusterName         Flavor              Nodes               AutoScale           Status
mycluster           container1-4G       1                   false               active

Configure and use the Docker CLI

In the terminal below

$ dvm use
Now using Docker 1.11.1

Run your first application

Run a WordPress blog with a MySQL database on an overlay network.

  1. Create a network to connect your containers.

    $ docker network create mynetwork
    ec98e17a760b82b5c0857e2e0d561019af67ef790170fac8413697d5ee183288
  2. Run a MySQL instance in a container.

    $ docker run --detach \
      --name mysql \
      --net mynetwork \
      --env MYSQL_ROOT_PASSWORD=my-root-pw \
      mysql:5.6
    ab8ca480c46d10143217c0ee323f8420b6ab93737033c937c2f4dbf8578435bb
  3. Run a WordPress instance in a container.

    $ docker run --detach \
      --name wordpress \
      --net mynetwork \
      --publish 80:80 \
      --env WORDPRESS_DB_HOST=mysql \
      --env WORDPRESS_DB_PASSWORD=my-root-pw \
      wordpress:4.4
    6770c91929409196976f5ad30631b0f2836cd3d888c39bb3e322e0f60ca7eb18
  4. Verify that your run was successful by viewing your running containers.

    $ docker ps -n=2
    CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                        NAMES
    6770c9192940        wordpress:4.4       "/entrypoint.sh apach"   About a minute ago   Up About a minute   104.130.0.124:80->80/tcp   57d513b9-ed36-487d-8415-4ac65b6d41a8-n1/wordpress
    ab8ca480c46d        mysql:5.6           "/entrypoint.sh mysql"   6 minutes ago        Up 6 minutes        3306/tcp                     57d513b9-ed36-487d-8415-4ac65b6d41a8-n1/mysql,57d513b9-ed36-487d-8415-4ac65b6d41a8-n1/wordpress/mysql
  5. View your WordPress site

    $ open http://$(docker port wordpress 80)
  6. (Optional) Remove your WordPress site.

    If you aren't going to use your WordPress site, we recommend that you remove it. Doing so removes both your WordPress and MySQL containers. This will delete any data and any posts you've made in the WordPress site.

    $ docker rm --force --volumes wordpress mysql
    wordpress
    mysql
  7. Run source ~/cleanup.env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment