container keep exiting right after running it
docker-compose.yaml:
web:
build: .
command: ./main
ports:
- "8888:3412"
volumes:
- .:/code
links:
- redis
redis:
image: redis
Dockerfile:
FROM golang:1.6
ADD main.go .
EXPOSE 3412
ENTRYPOINT /go
RUN go build main.go
so after running docker run -d imagename
, there is no running container
also docker logs containername
doesn't show anything
docker docker-compose
add a comment |
docker-compose.yaml:
web:
build: .
command: ./main
ports:
- "8888:3412"
volumes:
- .:/code
links:
- redis
redis:
image: redis
Dockerfile:
FROM golang:1.6
ADD main.go .
EXPOSE 3412
ENTRYPOINT /go
RUN go build main.go
so after running docker run -d imagename
, there is no running container
also docker logs containername
doesn't show anything
docker docker-compose
Could you include the rest of the code as well? The Go code, and how you buildimagename
?
– Harald Nordgren
Nov 18 '18 at 20:48
@HaraldNordgren the code worked fine (trieddocker run -it
and ran main manually which worked). it would log error if it couldnt build right ?
– danicheeta
Nov 18 '18 at 20:54
I didn't say there was anything wrong the rest of the code. But it helps us reproduce your exact problem to potentially help you fix it.
– Harald Nordgren
Nov 18 '18 at 21:05
add a comment |
docker-compose.yaml:
web:
build: .
command: ./main
ports:
- "8888:3412"
volumes:
- .:/code
links:
- redis
redis:
image: redis
Dockerfile:
FROM golang:1.6
ADD main.go .
EXPOSE 3412
ENTRYPOINT /go
RUN go build main.go
so after running docker run -d imagename
, there is no running container
also docker logs containername
doesn't show anything
docker docker-compose
docker-compose.yaml:
web:
build: .
command: ./main
ports:
- "8888:3412"
volumes:
- .:/code
links:
- redis
redis:
image: redis
Dockerfile:
FROM golang:1.6
ADD main.go .
EXPOSE 3412
ENTRYPOINT /go
RUN go build main.go
so after running docker run -d imagename
, there is no running container
also docker logs containername
doesn't show anything
docker docker-compose
docker docker-compose
asked Nov 18 '18 at 20:18
danicheetadanicheeta
1,004517
1,004517
Could you include the rest of the code as well? The Go code, and how you buildimagename
?
– Harald Nordgren
Nov 18 '18 at 20:48
@HaraldNordgren the code worked fine (trieddocker run -it
and ran main manually which worked). it would log error if it couldnt build right ?
– danicheeta
Nov 18 '18 at 20:54
I didn't say there was anything wrong the rest of the code. But it helps us reproduce your exact problem to potentially help you fix it.
– Harald Nordgren
Nov 18 '18 at 21:05
add a comment |
Could you include the rest of the code as well? The Go code, and how you buildimagename
?
– Harald Nordgren
Nov 18 '18 at 20:48
@HaraldNordgren the code worked fine (trieddocker run -it
and ran main manually which worked). it would log error if it couldnt build right ?
– danicheeta
Nov 18 '18 at 20:54
I didn't say there was anything wrong the rest of the code. But it helps us reproduce your exact problem to potentially help you fix it.
– Harald Nordgren
Nov 18 '18 at 21:05
Could you include the rest of the code as well? The Go code, and how you build
imagename
?– Harald Nordgren
Nov 18 '18 at 20:48
Could you include the rest of the code as well? The Go code, and how you build
imagename
?– Harald Nordgren
Nov 18 '18 at 20:48
@HaraldNordgren the code worked fine (tried
docker run -it
and ran main manually which worked). it would log error if it couldnt build right ?– danicheeta
Nov 18 '18 at 20:54
@HaraldNordgren the code worked fine (tried
docker run -it
and ran main manually which worked). it would log error if it couldnt build right ?– danicheeta
Nov 18 '18 at 20:54
I didn't say there was anything wrong the rest of the code. But it helps us reproduce your exact problem to potentially help you fix it.
– Harald Nordgren
Nov 18 '18 at 21:05
I didn't say there was anything wrong the rest of the code. But it helps us reproduce your exact problem to potentially help you fix it.
– Harald Nordgren
Nov 18 '18 at 21:05
add a comment |
1 Answer
1
active
oldest
votes
ENTRYPOINT /go
is equivalent to running /bin/sh -c /go
go
is actually a directory in your container, so it will fail, because shell cannot execute a directory.
remove the background flag -d
and use docker run imagename
and you will see this error
What you probably want is:
ENTRYPOINT /usr/local/go/bin/go
to use go as an executable from the container.
Or even better:
ENTRYPOINT ["/usr/local/go/bin/go"]
, so you would be able to pass arguments to go.
removed entrypoint and changed command to/go/main
, doesnt work and doesnt show any error
– danicheeta
Nov 18 '18 at 21:17
include the output of:docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53365038%2fcontainer-keep-exiting-right-after-running-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
ENTRYPOINT /go
is equivalent to running /bin/sh -c /go
go
is actually a directory in your container, so it will fail, because shell cannot execute a directory.
remove the background flag -d
and use docker run imagename
and you will see this error
What you probably want is:
ENTRYPOINT /usr/local/go/bin/go
to use go as an executable from the container.
Or even better:
ENTRYPOINT ["/usr/local/go/bin/go"]
, so you would be able to pass arguments to go.
removed entrypoint and changed command to/go/main
, doesnt work and doesnt show any error
– danicheeta
Nov 18 '18 at 21:17
include the output of:docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
add a comment |
ENTRYPOINT /go
is equivalent to running /bin/sh -c /go
go
is actually a directory in your container, so it will fail, because shell cannot execute a directory.
remove the background flag -d
and use docker run imagename
and you will see this error
What you probably want is:
ENTRYPOINT /usr/local/go/bin/go
to use go as an executable from the container.
Or even better:
ENTRYPOINT ["/usr/local/go/bin/go"]
, so you would be able to pass arguments to go.
removed entrypoint and changed command to/go/main
, doesnt work and doesnt show any error
– danicheeta
Nov 18 '18 at 21:17
include the output of:docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
add a comment |
ENTRYPOINT /go
is equivalent to running /bin/sh -c /go
go
is actually a directory in your container, so it will fail, because shell cannot execute a directory.
remove the background flag -d
and use docker run imagename
and you will see this error
What you probably want is:
ENTRYPOINT /usr/local/go/bin/go
to use go as an executable from the container.
Or even better:
ENTRYPOINT ["/usr/local/go/bin/go"]
, so you would be able to pass arguments to go.
ENTRYPOINT /go
is equivalent to running /bin/sh -c /go
go
is actually a directory in your container, so it will fail, because shell cannot execute a directory.
remove the background flag -d
and use docker run imagename
and you will see this error
What you probably want is:
ENTRYPOINT /usr/local/go/bin/go
to use go as an executable from the container.
Or even better:
ENTRYPOINT ["/usr/local/go/bin/go"]
, so you would be able to pass arguments to go.
edited Nov 18 '18 at 21:09
answered Nov 18 '18 at 20:57
Uku LoskitUku Loskit
30.3k86879
30.3k86879
removed entrypoint and changed command to/go/main
, doesnt work and doesnt show any error
– danicheeta
Nov 18 '18 at 21:17
include the output of:docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
add a comment |
removed entrypoint and changed command to/go/main
, doesnt work and doesnt show any error
– danicheeta
Nov 18 '18 at 21:17
include the output of:docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
removed entrypoint and changed command to
/go/main
, doesnt work and doesnt show any error– danicheeta
Nov 18 '18 at 21:17
removed entrypoint and changed command to
/go/main
, doesnt work and doesnt show any error– danicheeta
Nov 18 '18 at 21:17
include the output of:
docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
include the output of:
docker ps -n 1 --no-trunc
– Uku Loskit
Nov 18 '18 at 21:24
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
Exited (0) 12 minutes ago
– danicheeta
Nov 18 '18 at 21:29
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
please include the whole output
– Uku Loskit
Nov 18 '18 at 21:30
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
id:416f37a4af2150a3302dad7fcb1f8565d916eb55ce57d7113ea23099f2ef071c, k8s-temp_web:"/bin/bash", created:12 minutes ago, status:(0) 12 minutes ago, name:thirsty_northcutt
– danicheeta
Nov 19 '18 at 14:53
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53365038%2fcontainer-keep-exiting-right-after-running-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you include the rest of the code as well? The Go code, and how you build
imagename
?– Harald Nordgren
Nov 18 '18 at 20:48
@HaraldNordgren the code worked fine (tried
docker run -it
and ran main manually which worked). it would log error if it couldnt build right ?– danicheeta
Nov 18 '18 at 20:54
I didn't say there was anything wrong the rest of the code. But it helps us reproduce your exact problem to potentially help you fix it.
– Harald Nordgren
Nov 18 '18 at 21:05