Skip to content

Instantly share code, notes, and snippets.

@zembutsu
Created March 31, 2016 11:26
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 zembutsu/8cb8896d68c975e918e39a5262fc11f9 to your computer and use it in GitHub Desktop.
Save zembutsu/8cb8896d68c975e918e39a5262fc11f9 to your computer and use it in GitHub Desktop.
DigitalOceanにDocker MachineでCentOS7をプロビジョンする方法 ref: http://qiita.com/zembutsu/items/04f896a96d0fc857f3a7
$ export $do_token='自分のAPI_token'
$ docker-machine create \
--driver digitalocean \
--digitalocean-access-token $do_token \
--digitalocean-region sgp1 \
--digitalocean-size 2gb \
--digitalocean-image centos-7-0-x64 \
centos7-docker
Running pre-create checks...
Creating machine...
(centos7-docker) Creating SSH key...
(centos7-docker) Creating Digital Ocean droplet...
(centos7-docker) Waiting for IP address to be assigned to the Droplet...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with centos...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: (snip)
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
centos7-docker - digitalocean Running tcp://<ip>:2376 v1.10.3
$ docker-machine ssh centos7-docker
Last login: Thu Mar 31 07:17:47 2016 from xxx
[root@centos7-docker ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@centos7-docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ curl -H "Authorization: Bearer $do_token" \
-X GET "https://api.digitalocean.com/v2/images" | jq "."
{
"images": [
{
(省略)
{
"id": 16040476,
"name": "7.2 x64",
"distribution": "CentOS",
"slug": "centos-7-0-x64",
"public": true,
"regions": [
"nyc1",
"sfo1",
"nyc2",
"ams2",
"sgp1",
"lon1",
"nyc3",
"ams3",
"fra1",
"tor1"
],
"created_at": "2016-02-29T21:17:07Z",
"min_disk_size": 20,
"type": "snapshot"
},
(省略)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment