LoginSignup
0
0

More than 5 years have passed since last update.

build a Ruby On Rails 5.0 development environment on windows 10 with docker and ruby 2.5.0.

Last updated at Posted at 2018-04-10

PC using this time.

Think Pad
windows 10
Intel Core i3-4000M 2.40GHz or up
Memory: 4GB or up
Storege: 128GB or up

キャプチャ.PNG

What is docker

README FIRST for Docker Toolbox and Docker Machine users: Docker for Windows requires Microsoft Hyper-V to run. The Docker for Windows installer enables Hyper-V for you, if needed, and restart your machine. After Hyper-V is enabled, VirtualBox no longer works, but any VirtualBox VM images remain. VirtualBox VMs created with docker-machine (including the default one typically created during Toolbox install) no longer start. These VMs cannot be used side-by-side with Docker for Windows. However, you can still use docker-machine to manage remote VMs.

You need some setting when you use PC without Hyper-V.

Processes

a. Check your User Name.
Use English Username, if you have non-English name on your folder "C:/User//"User Name, you can't use "docker-compose command".
If you are using non-English name, you have to create new user, and start from "b."

Create Local Account Process is belows.
https://pc-karuma.net/windows10-create-local-account/

b. Turn on Virtualization Techology in BIOS.
See these instructions to install Hyper-V manually. A reboot is required. If you install Hyper-V without the reboot, Docker for Windows does not work correctly. On some systems, Virtualization needs to be enabled in the BIOS. The steps to do so are Vendor specific, but typically the BIOS option is called Virtualization Technology (VTx) or similar.
You need google it like "'Maker Name' BIOS virtualization Technology", since Settings are different depends on Makers.
Processes are Belows.
https://freesoft.tvbok.com/win10/access_uefi_bios_setup.html

c. Turn on Hyper-V(in case you have Hyper-V)

d. download&install docker
if you have Hyper-V
https://docs.docker.com/docker-for-windows/install/
if you don't have Hyper-V
https://docs.docker.com/toolbox/toolbox_install_windows/
After installing, you see the
Docker Quickstart Terminal
on Desktop
Click it, and start.

e. Set Environmetal Variable, "COMPOSE_CONVERT_WINDOWS_PATHS=1".
see belows.
https://qiita.com/asami-H-Ishi/items/5a6bb2102b3a07cbab41

f. Clone sample app.
(you need github account and login)
git clone https://github.com/akihitoalextsuboi/docker-rails.git

g. Start up docker-rails program.
cd docker-rails
docker-compose run web rails new . --force
docker-compose build
docker-compose up

h. access 192.168.99.100:3000(it can be 192.168.99.10x:3000)

i. when you want to stop the program, docker-compose down or Control+C
If you do double Control+C, you see these errors.
web_1 | A server is already
running. Check /myapp/tmp/pids/server.pid.
To resolve this, delete the file tmp/pids/server.pid, and then re-start the application with docker-compose up.
rm tmp/pids/server.pid

j. how to login to docker
docker-compose exec web bash

k. clone these files
https://github.com/akihitoalextsuboi/docker-rails

Notice

you can share files, based on docker-compose file.
https://docs.docker.com/compose/rails/

* when you can't use docker-compose command on windows, you need to set the environmental variable.
COMPOSE_CONVERT_WINDOWS_PATHS to 1 

If you want to open multiple terminals, open multiple docker quick terminal window.

参考
https://docs.docker.com/compose/rails/#more-compose-documentation
https://nulab-inc.com/ja/blog/typetalk/docker-tutorial-local-environment-team/
https://qiita.com/tomomomo1217/items/3e9664fd5290934f0815

https://qiita.com/acro5piano/items/ac3bef8a9f8bb9fdbdd5
https://qiita.com/KeitaMoromizato/items/ae1a57fc62b41b942d71

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0