1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

docker コマンド関連

Last updated at Posted at 2021-10-01

#Dockerコマンド

##Docker compose

コンテナの作成
docker-compose build

コンテナの起動(-dをつけることでバックグラウンドで実行可能)
docker-compose up
docker-compose start

コンテナに入る
docker exec -it コンテナ名 bash(など)

コンテナ名の確認
docker ps

コンテナの停止
docker-compose down
docker-compose stop

###起動時の違い
https://qiita.com/tegnike/items/bcdcee0320e11a928d46

###停止時の違い
https://www.ikkitang1211.site/entry/2021/03/09/084833

##Database(MySQL)の操作

MySQLに接続
コンテナに入り
mysql -u ユーザ名 -p
パスワードを入力

データベースを表示
SHOW DATABASES;

データベースに接続
USE データベース名;

テーブルを表示
SHOW TABLES;

テーブルの作成
CREATE TABLE users(id int, name varchar(10));

データの挿入
INSERT INTO users VALUES (1, 'test');

データの確認
SELECT * FROM users;

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?