To run a Docker container with GoCD CI/CD, you can follow these steps:

1. Create a Dockerfile for your application:

FROM golang:latest

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go build -o app .

EXPOSE 8080

CMD ["./app"]

2. Build the Docker image by running the following command in the same directory as your Dockerfile:
docker build -t my-app .
This will build a Docker image named "my-app" using the Dockerfile in the current directory.

3. Start the GoCD server by running the following command:
docker run -d -p 8153:8153 -p 8154:8154 --name my-gocd-server gocd/gocd-server:v21.1.0
This will start a GoCD server container named "my-gocd-server" and map ports 8153 and 8154 to the same ports on your local machine.

4. Create a GoCD agent container by running the following command:
docker run -d --name my-gocd-agent gocd/gocd-agent-alpine-3.12:v21.1.0
This will start a GoCD agent container named "my-gocd-agent" that will be used to execute your pipeline.

5. Set up your GoCD pipeline by creating a pipeline configuration file and pushing it to your GoCD server. For example:
pipeline {
  agent {
    label 'my-gocd-agent'
  }
  stages {
    stage('Build') {
      steps {
        sh 'docker run -d -p 8080:8080 my-app'
      }
    }
  }
}
This pipeline configuration file will create a stage called "Build" that will run a Docker container based on the "my-app" image you built earlier.

6. Run your pipeline by triggering it manually or by setting up a webhook to trigger it automatically.

When the pipeline runs, the GoCD agent container will execute the pipeline steps, including running the Docker container based on the "my-app" image.

That's it! You have now successfully run a Docker container with GoCD CI/CD.