LoginSignup
1
1

More than 5 years have passed since last update.

docker-api でコンテナ作成時にコンテナ名を指定する方法

Last updated at Posted at 2014-11-27

swipely/docker-api でコンテナを作成する際、コンテナ名を指定する方法です。

sample.rb
container = Docker::Container.create('name' => 'my_ubuntu', 'Image' => 'ubuntu:14.04')

上記のように、「name」で指定してやるだけです。
「Name」ではだめでした。

Docker Remote API (v1.12) の公式ドキュメントでは 、

Create a container
 Query Parameters:
 name – Assign the specified name to the container. Mus match /?[a-zA-Z0-9_-]+.

とあるように、Query Parameter としてコンテナ名を指定できるとありましたが、
swipely/docker-api ではどう指定すればいいのかわからなかったので、それを調べた結果でした。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1