I will leave a memorandum of commands that were useful in building the Docker environment. It is recommended when you have created it but the error cannot be resolved.
Container confirmation
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
797b4265f3d2 try_web "/bin/sh -c 'rm -f t…" 24 minutes ago Up 23 minutes 0.0.0.0:3000->3000/tcp try_web_1
Specify the CONTAINER ID.
Container stop
$ sudo docker stop 797b4265f3d2
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Since it just stopped, we will also delete it.
Container confirmation
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
797b4265f3d2 try_web "/bin/sh -c 'rm -f t…" 24 minutes ago Up 23 minutes 0.0.0.0:3000->3000/tcp try_web_1
Specify the CONTAINER ID.
Delete container
$ sudo docker rm 797b4265f3d2
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
I deleted the container, but the image remains.
Confirm image
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
try_web latest c0ee642ca6bd About an hour ago 1.01GB
Specify the IMAGE ID.
Delete image
$ sudo docker rmi c0ee642ca6bd
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
In my case, I got an Access denied for user error, so
I checked mysql.
#
After mysql-u root -Write p and log in to mysql.
Terminal
$ docker-compose up -d
$ docker-compose exec db bash
root@e5504121a08b:/# mysql -u root -p
If you want to exit, write exit.
Because the password was wrong here docker-compose exec app rails db:create I was getting the error.
This is just an example, and I think there are still useful commands. I hope it helps someone who is in the same situation as me.
Also, on twitter, technologies and ideas that are not uploaded to Qiita are also uploaded, so I would be grateful if you could follow me. Click here for details https://twitter.com/japwork
Recommended Posts