Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
추가 정보
docker 설치 시 docker-compose가 같이 설치되는데 docker-compose 명령어는 /usr/libexec/docker/cli-plugins/docker-compose 라는 요상한 곳에 설치가 됨
해당 path를 $PATH에 추가해도 좋겠지만...
난 그냥 /usr/local/bin 에 심볼릭 링크 추가함
root@Ubuntu24:~# dpkg -L docker-compose-plugin
/.
/usr
/usr/libexec
/usr/libexec/docker
/usr/libexec/docker/cli-plugins
/usr/libexec/docker/cli-plugins/docker-compose
/usr/share
/usr/share/doc
/usr/share/doc/docker-compose-plugin
/usr/share/doc/docker-compose-plugin/changelog.Debian.gz
root@Ubuntu24:~# ls -al /usr/local/bin/
total 8
drwxr-xr-x 2 root root 4096 Nov 25 23:48 .
drwxr-xr-x 10 root root 4096 May 7 2024 ..
lrwxrwxrwx 1 root root 46 Nov 25 23:48 docker-compose -> /usr/libexec/docker/cli-plugins/docker-compose
root@Ubuntu24:~# docker-compose --help
Usage: docker compose [OPTIONS] COMMAND
Define and run multi-container applications with Docker
Options:
--all-resources Include all resources, even those not used by services
--ansi string Control when to print ANSI control characters
("never"|"always"|"auto") (default "auto")
--compatibility Run compose in backward compatibility mode
--dry-run Execute command in dry run mode
--env-file stringArray Specify an alternate environment file
-f, --file stringArray Compose configuration files
--parallel int Control max parallelism, -1 for unlimited (default -1)
--profile stringArray Specify a profile to enable
--progress string Set type of progress output (auto, tty, plain, json,
quiet) (default "auto")
--project-directory string Specify an alternate working directory
(default: the path of the, first specified, Compose file)
-p, --project-name string Project name
Commands:
attach Attach local standard input, output, and error streams to a service's running container
build Build or rebuild services
config Parse, resolve and render compose file in canonical format
cp Copy files/folders between a service container and the local filesystem
create Creates containers for a service
down Stop and remove containers, networks
events Receive real time events from containers
exec Execute a command in a running container
images List images used by the created containers
kill Force stop service containers
logs View output from containers
ls List running compose projects
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pull service images
push Push service images
restart Restart service containers
rm Removes stopped service containers
run Run a one-off command on a service
scale Scale services
start Start services
stats Display a live stream of container(s) resource usage statistics
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker Compose version information
wait Block until containers of all (or specified) services stop.
watch Watch build context for service and rebuild/refresh containers when files are updated
Run 'docker compose COMMAND --help' for more information on a command.
root@Ubuntu24:~#
(.venv) ➜ projectGoguma (main) ✗ docker-compose exec web python manage.py createsuperuser --settings=projectGoguma.settings.dev
You have 162 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, home, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers.
Run 'python manage.py migrate' to apply them.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 88, in execute
return super().execute(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 109, in handle
default_username = get_default_username(database=database)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/__init__.py", line 168, in get_default_username
auth_app.User._default_manager.db_manager(database).get(
File "/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 633, in get
num = len(clone)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 380, in __len__
self._fetch_all()
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...
^
이리저리 다 수정을 한 것 같은데 왜 안될까???
docker container에 직접 attach를 해보니...
엥???
(.venv) ➜ projectGoguma (main) ✗ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c281852e6c92 projectgoguma_web "/app/entrypoint.sh …" About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp projectgoguma_web_1
06f0d1750419 postgres:13.5-alpine "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp projectgoguma_db_1
59ee14bdc489 hello-world "/hello" 3 weeks ago Exited (0) 3 weeks ago gallant_lamport
(.venv) ➜ projectGoguma (main) ✗ docker attach projectgoguma_web_1
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
nc를 왜 필요로 하지?
잘 모르겠지만 Dockerfile 에서 netcat 설치를 추가해 보니 문제 해결
# Install system packages required by Wagtail and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
libmariadbclient-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
netcat \
# environ \
# postgresql-dev \
# python3-dev \
# musl-dev \