英文:
How can I install go-migrate on a container in Docker?
问题
我正在学习容器和Docker,并且尝试使用go-migrate运行一个容器,但是我遇到了这个错误:
Dockerfile:33
--------------------
32 |
33 | >>> RUN curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | bash && \
34 | >>> apt-get update && \
35 | >>> apt-get install migrate
36 |
--------------------
错误:解决失败:"process "/bin/sh -c curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | bash && apt-get update && apt-get install migrate" 未成功完成:退出代码:100
我正在使用一台M1 MacBook,并且Dockerfile如下:
FROM golang:1.20.3
RUN curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | bash && \
apt-get update && \
apt-get install migrate
英文:
I am studying containers and Docker, and I am trying to run a container with go-migrate but I am getting this error:
Dockerfile:33
--------------------
32 |
33 | >>> RUN curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | bash && \
34 | >>> apt-get update && \
35 | >>> apt-get install migrate
36 |
--------------------
ERROR: failed to solve: process "/bin/sh -c curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | bash && apt-get update && apt-get install migrate" did not complete successfully: exit code: 100
I am using a M1 Macbook and the dockerfile is:
FROM golang:1.20.3
RUN curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | bash && \
apt-get update && \
apt-get install migrate
答案1
得分: 1
还有一个go install选项可以安装migrate。由于您正在使用go镜像,因此通过这种方式安装会更容易。
例如:
FROM golang:1.20.3
RUN go install -tags 'mysql' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
英文:
There is also an go install option to install migrate. Since you are using a go image hence it would be easier to install it that way
e.g.
FROM FROM golang:1.20.3
RUN go install -tags 'mysql' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论