Mercurial > hg > Applications > docker-wrapper
changeset 9:85547fef3119
fix source
author | taiki |
---|---|
date | Mon, 17 Nov 2014 09:13:36 +0900 (2014-11-17) |
parents | 5c26bbba0ee0 |
children | 9d6fb0a1aa53 |
files | README.md ie-docker.c |
diffstat | 2 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sun Nov 16 23:13:24 2014 +0900 +++ b/README.md Mon Nov 17 09:13:36 2014 +0900 @@ -7,3 +7,14 @@ ### TODO * make test docker ps for fedora + + +### sample command + +show process list + + ie-docker ps + +run docker image + + ie-docker run -it --name [user name]_[process name] fedora:latest /bin/bash
--- a/ie-docker.c Sun Nov 16 23:13:24 2014 +0900 +++ b/ie-docker.c Mon Nov 17 09:13:36 2014 +0900 @@ -20,7 +20,7 @@ #define build_command "build" #define attach_command "attach" #define dettach_command "dettach" -#define pull_command "pull" /* download docker image command */ +// #define pull_command "pull" /* download docker image command */ #define images_command "images" /* list images command */ #define commit_command "commit" /* make image command */ #define rm_command "rm" /* remove container command */ @@ -193,10 +193,10 @@ printf("Usage: ie-docker\n"); printf("\trun: run process\n"); printf("\tbuild: build docker process from Dockerfile\n"); - printf("\tattach: atach process\n"); - printf("\tdettach: \n"); - printf("\timages: \n"); - printf("\tcommit:\n"); + printf("\tattach: attach process\n"); + printf("\tdettach: dettach process\n"); + printf("\timages: list images\n"); + printf("\tcommit: \n"); printf("\tps-name should be students_e11_e115711_01 or teachers_kono_02\n"); } @@ -253,11 +253,9 @@ char *ps_name = (char *)malloc(sizeof(char) * PS_NAME_LENGTH); ps_name[0] = '\0'; if (strncmp(argv[1], "ps", 4) != 0) { - make_ps_name(ps_name, account_type, name, argv[2]); + make_ps_name(ps_name, account_type, name, argv[4]); } - printf("%s\n", ps_name); - if (argc >= 3) { if (strncmp(argv[1], run_command, 6) == 0 ) { if (strncmp(argv[3], "--name", 6) != 0) { @@ -265,12 +263,7 @@ exit(0); } - if (regexec(pattern, argv[4], (size_t) 0, NULL, 0)) { - fprintf(stderr, bad_name); - exit(0); - } - - if (check_name(argv[3])) { + if (check_name(argv[4])) { fprintf(stderr, bad_name); exit(0); } @@ -286,7 +279,7 @@ if (argv[1]==0 || strncmp(argv[1], "ps", 4) == 0 ) { print_pslist(pslist); } else if (strncmp(argv[1], run_command, 5) == 0) { - if (execl(command, command, run_command, argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], NULL) < 0) { + if (execl(command, command, run_command, argv[2], argv[3], ps_name, argv[5], argv[6], argv[7], NULL) < 0) { perror("Execl:"); } } else if (strncmp(argv[1], start_command, 5) == 0) {