Skip to content

Instantly share code, notes, and snippets.

@etoews etoews/
Last active May 31, 2016

What would you like to do?

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
  2. Run a MySQL instance in a container.

    $ docker run --detach \
      --name mysql \
      --net mynetwork \
      --env MYSQL_ROOT_PASSWORD=my-root-pw \
  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 \
  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       "/ apach"   About a minute ago   Up About a minute>80/tcp   57d513b9-ed36-487d-8415-4ac65b6d41a8-n1/wordpress
    ab8ca480c46d        mysql:5.6           "/ 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
  7. Run source ~/cleanup.env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.