0

Below is the docker file:

FROM golang:1.14.10

MAINTAINER xyz

ENV SOURCES /product-api

COPY . ${SOURCES}

WORKDIR /product-api

RUN make swagger

ENTRYPOINT product-api

After running the below commands:

$ docker build -t cloud-native-product-api:1.0.0

$ docker run -it -p 8080:8080 cloud-native-product-api:1.0.0


docker ps gives below output:

$ docker ps -a
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS              PORTS                    NAMES
9aa144b7873c        cloud-native-product-api:1.0.0   "/bin/sh -c product-…"   3 minutes ago       Up 3 minutes        0.0.0.0:9090->9090/tcp   trusting_matsumoto

Where does value trusting_matsumoto derive from in NAMES column?

Ashok
  • 3,190
  • 15
  • 31
overexchange
  • 15,768
  • 30
  • 152
  • 347

1 Answers1

1

Unless you specify a name for the container, docker assigns a random one.

You can specify a container name by using the --name argument:

$ docker run --rm -it --name my_alpine_container alpine

From the documentation

If you do not assign a container name with the --name option, then the daemon generates a random string name for you. Defining a name can be a handy way to add meaning to a container. If you specify a name, you can use it when referencing the container within a Docker network. This works for both background and foreground Docker containers.

DannyB
  • 12,810
  • 5
  • 55
  • 65