Skip to content

Commit 0bc6b1d

Browse files
Initialize the docker client from environment instead of arguments. (#2098)
* Initialize the docker client from environment instead of the arguments. * Initialize the docker client from environment instead of the arguments. * Update the client doc.
1 parent 4bfc93b commit 0bc6b1d

File tree

3 files changed

+6
-43
lines changed

3 files changed

+6
-43
lines changed

docs/designs/client_tool.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@ this command-line client tool.
5858
1. Build the Docker image for an ElasticDL job.
5959
6060
```bash
61-
elasticdl zoo build
62-
--image=a_docker_registry/bright/elasticdl-wnd:1.0
63-
[--docker_base_url=docke_base_url]
64-
[--docker_tlscert=docker_tlscert]
65-
[--docker_tlskey=docker_tlskey]
66-
.
61+
elasticdl zoo build --image=a_docker_registry/bright/elasticdl-wnd:1.0 .
6762
```
6863
6964
1. Push the Docker image to a remote registry.
@@ -79,7 +74,7 @@ this command-line client tool.
7974
8075
```bash
8176
elasticdl train \
82-
--image=a_docker_registry/bright/elasticdl-wnd:1.0 \
77+
--image_name=a_docker_registry/bright/elasticdl-wnd:1.0 \
8378
--model_zoo=model_zoo
8479
--model_def=a_directory.wide_and_deep.custom_model \
8580
--training_data=/data/mnist/train \

elasticdl_client/api.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,8 @@ def build_zoo(args):
7575
logger.info("Build the image for the model zoo.")
7676
# Call docker api to build the image
7777
# Validate the image name schema
78-
client = _get_docker_client(
79-
docker_base_url=args.docker_base_url,
80-
docker_tlscert=args.docker_tlscert,
81-
docker_tlskey=args.docker_tlskey,
82-
)
83-
for line in client.build(
78+
client = docker.DockerClient.from_env()
79+
for line in client.api.build(
8480
dockerfile="./Dockerfile",
8581
path=args.path,
8682
rm=True,
@@ -93,13 +89,8 @@ def build_zoo(args):
9389
def push_zoo(args):
9490
logger.info("Push the image for the model zoo.")
9591
# Call docker api to push the image to remote registry
96-
client = _get_docker_client(
97-
docker_base_url=args.docker_base_url,
98-
docker_tlscert=args.docker_tlscert,
99-
docker_tlskey=args.docker_tlskey,
100-
)
101-
102-
for line in client.push(args.image, stream=True, decode=True):
92+
client = docker.DockerClient.from_env()
93+
for line in client.api.push(args.image, stream=True, decode=True):
10394
_print_docker_progress(line)
10495

10596

elasticdl_client/common/args.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def add_zoo_build_arguments(parser):
4949
help="The name of the docker image we are building for"
5050
"this model zoo.",
5151
)
52-
add_docker_arguments(parser)
5352

5453

5554
def add_zoo_push_arguments(parser):
@@ -58,28 +57,6 @@ def add_zoo_push_arguments(parser):
5857
type=str,
5958
help="The name of the docker image for this model zoo.",
6059
)
61-
add_docker_arguments(parser)
62-
63-
64-
def add_docker_arguments(parser):
65-
parser.add_argument(
66-
"--docker_base_url",
67-
type=str,
68-
help="URL to the Docker server",
69-
default="unix://var/run/docker.sock",
70-
)
71-
parser.add_argument(
72-
"--docker_tlscert",
73-
type=str,
74-
help="Path to Docker client cert",
75-
default="",
76-
)
77-
parser.add_argument(
78-
"--docker_tlskey",
79-
type=str,
80-
help="Path to Docker client key",
81-
default="",
82-
)
8360

8461

8562
def add_train_params(parser):

0 commit comments

Comments
 (0)