Prezados,
criei um dockerfile seguindo a estrutura ensinada na aula:
version: "3.0"
services:
db:
image: mysql
environment:
- MYSQL_DATABASE=loja
- MYSQL_USER=root
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
volumes:
- ./mysql_data:/var/lib/mysql
web:
image: rafanercessian/aplicacao-loja:v1
ports:
- 8080:80
depends_on:
- db
Subi os containers com o docker-compose up
e executei os comandos abaixo no mysql (no database loja):
create table produtos (id integer auto_increment primary key, nome varchar(255), preco decimal(10,2));
alter table produtos add column usado boolean default false;
alter table produtos add column descricao varchar(255);
create table categorias (id integer auto_increment primary key, nome varchar(255));
insert into categorias (nome) values ("Futebol"), ("Volei"), ("Tenis");
alter table produtos add column categoria_id integer;
update produtos set categoria_id = 1;
Porém, ao acessar a aplicação em http://localhost:8080/ , não consigo cadastrar nem listar dados.
Aparece o seguinte erro nas páginas (exibido após o cabeçalho):
- no formulário:
Warning: mysqli_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in /var/www/html/conecta.php on line 4
Warning: mysqli_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers in /var/www/html/conecta.php on line 4
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /var/www/html/banco-categoria.php on line 7
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /var/www/html/banco-categoria.php on line 8
- na tela de listagem:
Warning: mysqli_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in /var/www/html/conecta.php on line 4
Warning: mysqli_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers in /var/www/html/conecta.php on line 4
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /var/www/html/banco-produto.php on line 5
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /var/www/html/banco-produto.php on line 6
Seguem os logs de execução dos containers:
$ docker-compose up
Removing kubernetesexample_web_1
kubernetesexample_db_1 is up-to-date
Recreating ef11ccc33da8_kubernetesexample_web_1 ... done
Attaching to kubernetesexample_db_1, kubernetesexample_web_1
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
web_1 | [Thu Apr 26 16:24:09.787045 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.31 configured -- resuming normal operations
web_1 | [Thu Apr 26 16:24:09.787067 2018] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
db_1 | Initializing database
db_1 | 2018-04-26T16:19:23.614065Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
db_1 | 2018-04-26T16:19:23.614159Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.11) initializing of server in progress as process 31
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
db_1 | 2018-04-26T16:19:41.896577Z 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
db_1 | 2018-04-26T16:19:46.553748Z 5 [Warning] [MY-010315] [Server] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-04-26T16:19:46.553785Z 5 [Warning] [MY-010315] [Server] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-04-26T16:19:46.553794Z 5 [Warning] [MY-010315] [Server] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-04-26T16:19:46.553806Z 5 [Warning] [MY-010315] [Server] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
Alguém pegou algum problema parecido? O que pode ser?