error running db migrate with docker for rails
I'm trying to set up an dev environment for Vue.js and rails API following a tutorial.
Eventually I hit a hurdle when trying to run the following command:
docker-compose run backend rails db:create
Here is the error:
$ docker-compose run backend rails db:create
Starting am-full-stack_db_1_b7f6ee37d2e4 ... done
Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
"rails": executable file not found in $PATH": unknown
Here is my file tree
App
autheg-backend
autheg-frontend
docker-compose.yml
Here is my docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Result of 'docker-compose run backend env'
PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=c88e0c72c584
TERM=xterm
RUBY_MAJOR=2.5
RUBY_VERSION=2.5.3
RUBY_DOWNLOAD_SHA256=1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f
RUBYGEMS_VERSION=2.7.8
BUNDLER_VERSION=1.17.1
GEM_HOME=/usr/local/bundle
BUNDLE_PATH=/usr/local/bundle
BUNDLE_SILENCE_ROOT_WARNING=1
BUNDLE_APP_CONFIG=/usr/local/bundle
APP=/usr/src/app
HOME=/home/rails
Thanks!
ruby-on-rails macos docker
add a comment |
I'm trying to set up an dev environment for Vue.js and rails API following a tutorial.
Eventually I hit a hurdle when trying to run the following command:
docker-compose run backend rails db:create
Here is the error:
$ docker-compose run backend rails db:create
Starting am-full-stack_db_1_b7f6ee37d2e4 ... done
Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
"rails": executable file not found in $PATH": unknown
Here is my file tree
App
autheg-backend
autheg-frontend
docker-compose.yml
Here is my docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Result of 'docker-compose run backend env'
PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=c88e0c72c584
TERM=xterm
RUBY_MAJOR=2.5
RUBY_VERSION=2.5.3
RUBY_DOWNLOAD_SHA256=1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f
RUBYGEMS_VERSION=2.7.8
BUNDLER_VERSION=1.17.1
GEM_HOME=/usr/local/bundle
BUNDLE_PATH=/usr/local/bundle
BUNDLE_SILENCE_ROOT_WARNING=1
BUNDLE_APP_CONFIG=/usr/local/bundle
APP=/usr/src/app
HOME=/home/rails
Thanks!
ruby-on-rails macos docker
what is the output ofdocker-compose run backend env
?
– Uku Loskit
Nov 26 '18 at 6:38
@UkuLoskit added to question!
– Ricky Mason
Nov 26 '18 at 13:51
I am seeing the same thing on this tutorial. Did you figure this out @Ricky?
– user2799827
Dec 15 '18 at 3:31
add a comment |
I'm trying to set up an dev environment for Vue.js and rails API following a tutorial.
Eventually I hit a hurdle when trying to run the following command:
docker-compose run backend rails db:create
Here is the error:
$ docker-compose run backend rails db:create
Starting am-full-stack_db_1_b7f6ee37d2e4 ... done
Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
"rails": executable file not found in $PATH": unknown
Here is my file tree
App
autheg-backend
autheg-frontend
docker-compose.yml
Here is my docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Result of 'docker-compose run backend env'
PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=c88e0c72c584
TERM=xterm
RUBY_MAJOR=2.5
RUBY_VERSION=2.5.3
RUBY_DOWNLOAD_SHA256=1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f
RUBYGEMS_VERSION=2.7.8
BUNDLER_VERSION=1.17.1
GEM_HOME=/usr/local/bundle
BUNDLE_PATH=/usr/local/bundle
BUNDLE_SILENCE_ROOT_WARNING=1
BUNDLE_APP_CONFIG=/usr/local/bundle
APP=/usr/src/app
HOME=/home/rails
Thanks!
ruby-on-rails macos docker
I'm trying to set up an dev environment for Vue.js and rails API following a tutorial.
Eventually I hit a hurdle when trying to run the following command:
docker-compose run backend rails db:create
Here is the error:
$ docker-compose run backend rails db:create
Starting am-full-stack_db_1_b7f6ee37d2e4 ... done
Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
"rails": executable file not found in $PATH": unknown
Here is my file tree
App
autheg-backend
autheg-frontend
docker-compose.yml
Here is my docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Result of 'docker-compose run backend env'
PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=c88e0c72c584
TERM=xterm
RUBY_MAJOR=2.5
RUBY_VERSION=2.5.3
RUBY_DOWNLOAD_SHA256=1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f
RUBYGEMS_VERSION=2.7.8
BUNDLER_VERSION=1.17.1
GEM_HOME=/usr/local/bundle
BUNDLE_PATH=/usr/local/bundle
BUNDLE_SILENCE_ROOT_WARNING=1
BUNDLE_APP_CONFIG=/usr/local/bundle
APP=/usr/src/app
HOME=/home/rails
Thanks!
ruby-on-rails macos docker
ruby-on-rails macos docker
edited Nov 26 '18 at 13:52
Ricky Mason
asked Nov 26 '18 at 5:19
Ricky MasonRicky Mason
99742249
99742249
what is the output ofdocker-compose run backend env
?
– Uku Loskit
Nov 26 '18 at 6:38
@UkuLoskit added to question!
– Ricky Mason
Nov 26 '18 at 13:51
I am seeing the same thing on this tutorial. Did you figure this out @Ricky?
– user2799827
Dec 15 '18 at 3:31
add a comment |
what is the output ofdocker-compose run backend env
?
– Uku Loskit
Nov 26 '18 at 6:38
@UkuLoskit added to question!
– Ricky Mason
Nov 26 '18 at 13:51
I am seeing the same thing on this tutorial. Did you figure this out @Ricky?
– user2799827
Dec 15 '18 at 3:31
what is the output of
docker-compose run backend env
?– Uku Loskit
Nov 26 '18 at 6:38
what is the output of
docker-compose run backend env
?– Uku Loskit
Nov 26 '18 at 6:38
@UkuLoskit added to question!
– Ricky Mason
Nov 26 '18 at 13:51
@UkuLoskit added to question!
– Ricky Mason
Nov 26 '18 at 13:51
I am seeing the same thing on this tutorial. Did you figure this out @Ricky?
– user2799827
Dec 15 '18 at 3:31
I am seeing the same thing on this tutorial. Did you figure this out @Ricky?
– user2799827
Dec 15 '18 at 3:31
add a comment |
3 Answers
3
active
oldest
votes
Where is your backened dockerfile for rails development like this example:-
# Base image:
FROM ruby:2.5
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# create application directory
RUN mkdir /myapp
# Set our working directory inside the image
WORKDIR /myapp
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
EXPOSE 3000
CMD [ "bundle", "exec", "puma", "-C", "config/puma.rb" ]
add a comment |
This is caused because the path is not set in the Docker container, it's set on your development/local machine. Use the following command:
docker-compose run backend bundle exec rails db:create
add a comment |
to do db migration use:
docker-compose run backend bin/rails db:create
# or
docker-compose run backend bundle exec rails db:create
/backend/Dockerfile
FROM ruby:2.5
ARG UID
RUN adduser rails --uid $UID --disabled-password --gecos ""
ENV APP /usr/src/app
RUN mkdir $APP
WORKDIR $APP
COPY Gemfile* $APP/
RUN bundle install -j3 --path vendor/bundle
COPY . $APP/
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
CMD [ "bundle", "exec", "rails", "server", "-p", "8080", "-b", "0.0.0.0"]
./docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
command: bundle exec rails s -p 8080 -b '0.0.0.0'
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Then
docker-compose up
Now you should be able to see the rails site using:
localhost:8080 (instead of 3000)
Hope that helps you get started
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%2f53475116%2ferror-running-db-migrate-with-docker-for-rails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Where is your backened dockerfile for rails development like this example:-
# Base image:
FROM ruby:2.5
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# create application directory
RUN mkdir /myapp
# Set our working directory inside the image
WORKDIR /myapp
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
EXPOSE 3000
CMD [ "bundle", "exec", "puma", "-C", "config/puma.rb" ]
add a comment |
Where is your backened dockerfile for rails development like this example:-
# Base image:
FROM ruby:2.5
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# create application directory
RUN mkdir /myapp
# Set our working directory inside the image
WORKDIR /myapp
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
EXPOSE 3000
CMD [ "bundle", "exec", "puma", "-C", "config/puma.rb" ]
add a comment |
Where is your backened dockerfile for rails development like this example:-
# Base image:
FROM ruby:2.5
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# create application directory
RUN mkdir /myapp
# Set our working directory inside the image
WORKDIR /myapp
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
EXPOSE 3000
CMD [ "bundle", "exec", "puma", "-C", "config/puma.rb" ]
Where is your backened dockerfile for rails development like this example:-
# Base image:
FROM ruby:2.5
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# create application directory
RUN mkdir /myapp
# Set our working directory inside the image
WORKDIR /myapp
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
EXPOSE 3000
CMD [ "bundle", "exec", "puma", "-C", "config/puma.rb" ]
answered Dec 26 '18 at 6:22
Upendra ChaharUpendra Chahar
965
965
add a comment |
add a comment |
This is caused because the path is not set in the Docker container, it's set on your development/local machine. Use the following command:
docker-compose run backend bundle exec rails db:create
add a comment |
This is caused because the path is not set in the Docker container, it's set on your development/local machine. Use the following command:
docker-compose run backend bundle exec rails db:create
add a comment |
This is caused because the path is not set in the Docker container, it's set on your development/local machine. Use the following command:
docker-compose run backend bundle exec rails db:create
This is caused because the path is not set in the Docker container, it's set on your development/local machine. Use the following command:
docker-compose run backend bundle exec rails db:create
edited Jan 3 at 21:21
answered Dec 25 '18 at 19:14
Derek CDerek C
11
11
add a comment |
add a comment |
to do db migration use:
docker-compose run backend bin/rails db:create
# or
docker-compose run backend bundle exec rails db:create
/backend/Dockerfile
FROM ruby:2.5
ARG UID
RUN adduser rails --uid $UID --disabled-password --gecos ""
ENV APP /usr/src/app
RUN mkdir $APP
WORKDIR $APP
COPY Gemfile* $APP/
RUN bundle install -j3 --path vendor/bundle
COPY . $APP/
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
CMD [ "bundle", "exec", "rails", "server", "-p", "8080", "-b", "0.0.0.0"]
./docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
command: bundle exec rails s -p 8080 -b '0.0.0.0'
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Then
docker-compose up
Now you should be able to see the rails site using:
localhost:8080 (instead of 3000)
Hope that helps you get started
add a comment |
to do db migration use:
docker-compose run backend bin/rails db:create
# or
docker-compose run backend bundle exec rails db:create
/backend/Dockerfile
FROM ruby:2.5
ARG UID
RUN adduser rails --uid $UID --disabled-password --gecos ""
ENV APP /usr/src/app
RUN mkdir $APP
WORKDIR $APP
COPY Gemfile* $APP/
RUN bundle install -j3 --path vendor/bundle
COPY . $APP/
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
CMD [ "bundle", "exec", "rails", "server", "-p", "8080", "-b", "0.0.0.0"]
./docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
command: bundle exec rails s -p 8080 -b '0.0.0.0'
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Then
docker-compose up
Now you should be able to see the rails site using:
localhost:8080 (instead of 3000)
Hope that helps you get started
add a comment |
to do db migration use:
docker-compose run backend bin/rails db:create
# or
docker-compose run backend bundle exec rails db:create
/backend/Dockerfile
FROM ruby:2.5
ARG UID
RUN adduser rails --uid $UID --disabled-password --gecos ""
ENV APP /usr/src/app
RUN mkdir $APP
WORKDIR $APP
COPY Gemfile* $APP/
RUN bundle install -j3 --path vendor/bundle
COPY . $APP/
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
CMD [ "bundle", "exec", "rails", "server", "-p", "8080", "-b", "0.0.0.0"]
./docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
command: bundle exec rails s -p 8080 -b '0.0.0.0'
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Then
docker-compose up
Now you should be able to see the rails site using:
localhost:8080 (instead of 3000)
Hope that helps you get started
to do db migration use:
docker-compose run backend bin/rails db:create
# or
docker-compose run backend bundle exec rails db:create
/backend/Dockerfile
FROM ruby:2.5
ARG UID
RUN adduser rails --uid $UID --disabled-password --gecos ""
ENV APP /usr/src/app
RUN mkdir $APP
WORKDIR $APP
COPY Gemfile* $APP/
RUN bundle install -j3 --path vendor/bundle
COPY . $APP/
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
CMD [ "bundle", "exec", "rails", "server", "-p", "8080", "-b", "0.0.0.0"]
./docker-compose.yml
version: '3'
services:
db:
image: postgres
ports:
- "5432"
backend:
build:
context: autheg-backend
args:
UID: ${UID:-1001}
command: bundle exec rails s -p 8080 -b '0.0.0.0'
volumes:
- ./autheg-backend:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
user: rails
frontend:
build:
context: autheg-frontend
args:
UID: ${UID:-1001}
volumes:
- ./autheg-frontend:/usr/src/app
ports:
- "3000:3000"
user: frontend
Then
docker-compose up
Now you should be able to see the rails site using:
localhost:8080 (instead of 3000)
Hope that helps you get started
answered Jan 13 at 20:40
Bill TihenBill Tihen
1
1
add a comment |
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.
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%2f53475116%2ferror-running-db-migrate-with-docker-for-rails%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
what is the output of
docker-compose run backend env
?– Uku Loskit
Nov 26 '18 at 6:38
@UkuLoskit added to question!
– Ricky Mason
Nov 26 '18 at 13:51
I am seeing the same thing on this tutorial. Did you figure this out @Ricky?
– user2799827
Dec 15 '18 at 3:31