aws ecr get-login --no-include-email --region ap-northeast-1 > login.sh ←一行です
[ec2-user@ip-10-128-1-19 ECR]$ bash ./login.sh
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /home/ec2-user/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded ← これが出ればログイン成功
docker-compose.ymlファイルのあるディレクトリで以下のコマンドを実行します。完了したら,docker ps -a コマンドで動作しているかどうか確認します。
sudo su
cd /usr/local/src/redmine
/usr/local/bin/docker-compose up -d
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9e7f0be2bc5b redmine:4.2 "/docker-entrypoint.…" 7 seconds ago Up 5 seconds 0.0.0.0:80->3000/tcp, :::80->3000/tcp redmine
3cd27d886b4f mariadb "docker-entrypoint.s…" 8 seconds ago Up 6 seconds 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp redmine-db
#コンテナからイメージの作成
$ docker commit redmine redminesql
#イメージの確認
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redminesql latest 304ab9ccde49 8 seconds ago 554MB
fortune-whale latest 0df1bdab20e2 2 days ago 280MB
redmine 4.2 d4ea63462562 2 days ago 531MB
mariadb latest 4a632f970181 2 weeks ago 401MB
docker/whalesay latest 6b362a9f73eb 7 years ago 247MB