Laravel container Linking to Docker memcached container

i try to use docker container to link memcached container,but $serve[‘port’] get full URL

here for some information

laravel .env

MEMCACHED_HOST=memcached
MEMCACHED_PORT=11211

docker for laravel project

docker File

FROM ubuntu:18.04

ENV DEBIAN_FRONTEND=noninteractive

RUN   apt-get update 
RUN   apt-get install -y software-properties-common language-pack-en-base sed
RUN LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

RUN apt-get update && apt-get install -yq --no-install-recommends 
    apt-utils 
    curl 
    # Install git
    git 
    # Install apache
    apache2 
    # Install php 7.3
    libapache2-mod-php7.3 
    php7.3-cli 
    php7.3-json 
    php7.3-curl 
    php7.3-fpm 
    php7.3-gd 
    php7.3-ldap 
    php7.3-mbstring 
    php7.3-mysql 
    php7.3-soap 
    php7.3-sqlite3 
    php7.3-xml 
    php7.3-zip 
    php7.3-intl 
    php-imagick 
    php7.3-GD 
    php7.3-bcmath 
    php7.3-dev 
    # Install tools
    openssl 
    graphicsmagick 
    imagemagick 
    ghostscript 
    mysql-client 
    iputils-ping 
    locales 
    sqlite3 
    ca-certificates 
    wget 
    php-memcached 
    vim 
    && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN echo " 
    n
    extension_dir = './'n
    extension     = memcache.son
    n" >> /etc/php/7.3/fpm/php.ini

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Set locales
RUN locale-gen en_US.UTF-8 en_GB.UTF-8 de_DE.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 it_IT.UTF-8 km_KH sv_SE.UTF-8 fi_FI.UTF-8

COPY 000-default.conf /etc/apache2/sites-available/
RUN a2enmod rewrite

EXPOSE 80 443

WORKDIR /var/www/html

RUN rm index.html

HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD curl -f http://localhost || exit 1

CMD apachectl -D FOREGROUND 

docker run --name DAC -d --link mysql57:mysql -p 8082:80 -v --link memcached:memcached dac

docker memcached images use official memcached:latest
https://hub.docker.com/_/memcached

docker run --name memcached -d memcached

but unfortunately when laravel MemcachedConnector->connect i get the error message



/var/www/html/dataAnalysisControl/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php

    public function connect(array $servers, $connectionId = null, array $options = [], array $credentials = [])
    {
        $memcached = $this->getMemcached(
            $connectionId, $credentials, $options
        );

        if (! $memcached->getServerList()) {

            foreach ($servers as $server) {
                $memcached->addServer(
                    $server['host'], $server['port'], $server['weight']
                );
            }
        }

        return $memcached;
    }

"Memcached::addServer() expects parameter 2 to be int, string given"

then i found $server[‘port’] get not usually

there is i dump the $servers and found this port it should be 11211

but i got tcp://172.17.0.4:11211 so get the string given error

array:1 [▼
  0 => array:3 [▼
    "host" => "memcached"
    "port" => "tcp://172.17.0.4:11211"
    "weight" => 100
  ]
]

so i try test a original connect

$m = new Memcached();
$m->addServer('memcached', 11211);
$version = $m->getVersion();
$m->set('key', 'test');
$get_value = $m->get('key');

dd($version,$get_value)

/////////dump///////
array:1 [▼
  "memcached:11211" => "1.5.19"
]

'test'

it look like memcached connect not a problem

so clearly, I am silly miss a step at somewhere here.

I hope someone can help me give me a solution.

Source: StackOverflow