Results 1 to 3 of 3

Thread: Why can't I execute my command?

  1. #1
    Join Date
    Oct 2019
    Beans
    3

    Why can't I execute my command?

    I intend to run a docker container with command:
    Code:
    docker run \
    -it \
    --env="DISPLAY=$DISPLAY" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --volume="/home:/home \
    ubuntu:16.04
    I COPY the command ,PASTE into the terminal,press ENTER ,then I got
    Code:
    lxq@ubuntu:~$ docker run \
    > -it \
    > --env="DISPLAY=$DISPLAY" \
    > --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    > --volume="/home:/home \
    > ubuntu:16.04
    > 
    > 
    >
    everytime I press ENTER,a `>`shows up.
    I've tried `ctrl+c`,`ctrl+d`,but didn't work.

    If I input the command manually,the command works fine.

    My question is :
    Why does it happen?
    How can I fix it?(i.e. run the command using COPY and PASTE)

    Thanks!

  2. #2
    Join Date
    Oct 2019
    Beans
    3

    Re: Why can't I execute my command?

    my bad ,I missed a double quotation mark after ‘home’

  3. #3
    Join Date
    Sep 2006
    Beans
    1,894
    Distro
    Ubuntu Development Release

    Re: Why can't I execute my command?

    Hello,

    I think that you should enclose the code using sideways double chevrons like:
    docker run \ << EOF
    > -it \
    > --env="DISPLAY=$DISPLAY" \
    > --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    > --volume="/home:/home \
    > ubuntu:16.04
    EOF

    Is it working that way? By pressing enter and seeing that more > are added it means that it cannot understand that the group of commands has ended, that's why by triggering EOF (End-Of-File) it does that exactly.

    edit: good that you found solution, EOF is handy in many cases as well.

    Regards!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •