Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Golang Tutorial doesn't work #104

Open
TsuyoshiUshio opened this issue Mar 3, 2018 · 1 comment
Open

The Golang Tutorial doesn't work #104

TsuyoshiUshio opened this issue Mar 3, 2018 · 1 comment

Comments

@TsuyoshiUshio
Copy link

I try the Golang tutorial to learn the Metaparticle. However, it doesn't work. I can fix several issues however, I can't solve an error. I can run through the tutorial, I'd happy to send a pull request for the doc.

1. There is no sample under tutorial/go

It is on the tutorial web page. so no problem.

2. go get fails

go get https://github.com/metaparticle-io/package/go/metaparticle

fails. It is the same error as this issue.

#62

We can solve the same solution (install dep and solve the dependency)

3. The second sample didn't work.

This sample cause an error now, metaparticle.Containerize need &metaparticle.Runtime to run it.
To solve this, just add Runtime. It is added the next sample.

func main() {
	metaparticle.Containerize(
		&metaparticle.Package{
			Name:       "metaparticle-web-demo",
			Repository: "your-docker-user-goes-here",
			Builder:    "docker",
			Verbose:    true,
			Publish:    true,
		},
		func() {
			log.Println("Starting server on :8080")
			http.HandleFunc("/", handler)
			err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil)
			if err != nil {
				log.Fatal("Couldn't start the server: ", err)
			}
		})
}

4. repository name must be canonical error

When I tried

go run main.go

It cause this error. metaparticle already has created the same image, when I try docker push tsuyoshiushio/mdemo by myself, it works.

Successfully built 92f2ff7c4e5d
Successfully tagged tsuyoshiushio/mdemo:latest
panic: Could not push image "tsuyoshiushio/mdemo" to the repository: Error sending push request to docker: repository name must be canonical

goroutine 1 [running]:
github.com/metaparticle-io/package/go/metaparticle.Containerize(0xc4201346c0, 0xc4205a90c0, 0x144d350)
	/Users/ushio/Codes/metaparticle/experiment/src/github.com/metaparticle-io/package/go/metaparticle/metaparticle.go:161 +0x651
main.main()
	/Users/ushio/Codes/metaparticle/experiment/src/github.com/TsuyoshiUshio/MetaparticleSpike/main.go:21 +0x146
exit status 2

This error might be related this issue.

ImagePull in golang client v17.03.1-ce fails with 'repository name must be canonical' #32372

The guy is just down grade docker package, however, I guess it is not proper way to solve this error. Any ideas?

@ahmedalhulaibi
Copy link

ahmedalhulaibi commented Mar 22, 2018

I had all the same issues and I hit the same roadblock. I set Publish to false in the metaparticle.Package to at least run locally automatically.

running docker push manually also worked for me so still need a fix on the docker push

&metaparticle.Package{
			Name:       "metaparticle-web-demo",
			Repository: "your-docker-user-goes-here",
			Builder:    "docker",
			Verbose:    true,
			Publish:    false,
		},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants