Home > Mobile >  docker run –it ubuntu:18.04 /bin/bash gives invalid reference format
docker run –it ubuntu:18.04 /bin/bash gives invalid reference format

Time:11-18

root@juan-virtual-machine:~# docker run –it ubuntu:18.04 /bin/bash
docker: invalid reference format.
See 'docker run --help'.
root@juan-virtual-machine:~# 

I try create a custom container with ubuntu:18.04, and show me this message.

CodePudding user response:

I believe you are trying to attach an interactive shell. The /bin/bash can be used as an entrypoint. The entrypoint is a starting command for containers. Double check the syntax, sometimes when copying and pasting from a google doc it'll add space or mess up some of the dashes

This is how you'd build your container with the ubuntu image:

docker run -it ubuntu:18.04 --entrypoint /bin/bash

Helpful Link: https://blog.knoldus.com/a-look-at-cmd-and-entrypoint-in-dockerfile/

CodePudding user response:

It is because you probably copy/pasted the command line from some web site. Although it looks same, what you put before it is not the real hyphen (-). It is en-dash (). Replace that with - real hyphen, it should work.

run -it ubuntu:18.04 /bin/bash

When you use em-dash or en-dash instead of hyphen, docker does not take –it as a parameter, but as an image name, so you get the invalid reference format error.

See unicode information em-dash: U 2014, en-dash: U 2013 and hyphen: U 2010

  • Related